Labels

Tuesday, January 13, 2009

Code - New Window and Session Sharing

Code - New Window and Session Sharing-

 

This is in addiotion to the Post in Dec 2008 - Link

 

Server Side

protected void lnkNewWindow_Click(object sender, EventArgs e)

{

            try

            {

                //System.Diagnostics.Process.Start("Iexplore.exe", "http://localhost/MxWebUI/login.aspx");

                System.Diagnostics.Process.Start("Firefox.exe", "http://localhost/MxWebUI/login.aspx");

            }

            catch (Exception ex)

            {

                Trace.Write(ex.Message);

            }

}

 

<asp:LinkButton ID="lnkNewWindow" CausesValidation="false" runat="server" OnClick="lnkNewWindow_Click"

Text="<%$ Resources:LinkNewWindow %>"></asp:LinkButton>                                       

 

 

Client Side

function OpenNewWindow()

{

    var path = window.location.href;

    var index = path.lastIndexOf("/");

    path = path.substring(0, index);

    path = path + "/login.aspx";

    var WshShell = new ActiveXObject("WScript.Shell");

    WshShell.Run("Iexplore " + path);

}

 

 

<asp:LinkButton ID="lnkNewWindow" CausesValidation="false" runat="server"  OnClientClick="Javascript:OpenNewWindow();" Text="<%$ Resources:LinkNewWindow %>"></asp:LinkButton>

 

 

 

 

 

 

 

Thanks & Regards,

Arun Manglick || Senior Tech Lead

 

No comments:

Post a Comment