With growing usage of Tabbed browsing this can be requirement in some cases that separate sessions should be used for multiple Tabs.
ASP .Net 2.0 (and MAY BE later versions) provide a smart solution for this purpose. The solution is to add following line in your web.config file
<sessionState mode="InProc" cookieless="UseUri"></sessionState>
above line should be added in system.web section of web.config. This will add the session value in URL
During my life of ASP .Net development I came across some issues which I am trying to bind at one place with the solution for other people.
Auto Ad Code
Showing posts with label session. Show all posts
Showing posts with label session. Show all posts
Monday, January 31, 2011
Tuesday, July 6, 2010
Subdomains and Session expiry issue
Many of us use the subdomains in our website. This is pretty simple but things get hectic when we see Session variables are lost while navigating in between Subdomains.
How to overcome this?
Okay here is the solution..
Add following Page_Unload function in every page from where you are navigating to any other Subdomain
Protected Sub Page_Unload(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Unload
Context.Response.Cookies.Item("ASP.NET_SessionId").Domain = "[YOUR WEBSITE]" Dim sessionCookie As New Web.HttpCookie("ASP.NET_SessionId", Context.Session.SessionID)sessionCookie.Domain = "[YOUR WEBSITE]"
Context.Response.SetCookie(sessionCookie)
End Sub
Where [YOUR WEBSITE] should be in form = .myweb.com i.e. dot yourwebsite dot com/net/org/co.in/co.uk etc
Subscribe to:
Posts (Atom)