0

I wanted to open an asp.net application with a new session in the same browser but in a different tab. Please let me know the solution if it is possible.

Spectre87
  • 2,374
  • 1
  • 24
  • 37
Mukesh Sakre
  • 156
  • 2
  • 13
  • Check out this topic: http://stackoverflow.com/questions/368653/how-to-differ-sessions-in-browser-tabs?rq=1 – Daniel Jul 10 '12 at 05:00

1 Answers1

0

The easiest solution is to configure session don't use cookies for session identifier and open new window with client code. To implement such approach you need to set cookieless atribute of the session element in web.config file to UseUri. Be warned about available side-effects in this case (quote from the MSDN):

Note When you configure an AJAX-enabled ASP.NET Web site, use only the default value of UseCookies for the cookieless attribute. Settings that use cookies encoded in the URL are not supported by the ASP.NET AJAX client script libraries.

After that you can open new tab with new session with javascript as below:

<form id="form1" runat="server">
Session Id:
<%= Session.SessionID %>
<hr />
<input type="button" value="Open New Tab" onclick="openNewTab()" />
<script type="text/javascript">
    function openNewTab() {
        window.open(location.protocol + "//" + location.host + "/Default.aspx", "_blank");
    }
</script>
</form>

Or you can to implement custom SessionIDManager that not use cookies for session identifier: SessionIDManager Class

Yuriy Rozhovetskiy
  • 22,270
  • 4
  • 37
  • 68