Click here to Skip to main content
15,904,348 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

how can i use unique sessions in a browser multiple tabs?
i've done research and found this line of code
HTML
<sessionState mode="InProc" cookieless="UseUri" />

i used the above code also but its not working well. I have formsauthentication also.
are there any other way?

Help me for this.
Thanks in advance.
Posted
Updated 18-Jul-12 22:43pm
v2
Comments
sandeep nagabhairava 19-Jul-12 4:43am    
hi your question was not clear, could you please pxplore your question in detail... multiple tabs means are you using masterpage?
jeyamothi 19-Jul-12 5:48am    
yes i am using master page. If i paste the url (my application) it redirect to my application instead of login page.

1 solution

That would be difficult to achieve. It's browser feature. Only possible way could be to place/keep track of a tab by keeping a hidden value on the page and sending that across with every request to make sure it is for the same session.

Read more about it here in detail: Stop Sharing Session State between Multiple Tabs of Browser[^]

Easiest and ok-ok implementation (keeping disadvantages in check), following can be tried:
Manually generate unique page identification code and insert it into hidden field on every page.
ASP.NET
<asp:HiddenField ID="PageID" runat="server" />


In the form load include following code. It will generate unique page identification code based on millisecond and other time component which always be unique for your site.
VB
If Not IsPostaback Then
  'Generate a new PageiD'
  Dim R As New Random(DateTime.Now.Millisecond +
         DateTime.Now.Second * 1000 +
         DateTime.Now.Minute * 60000 +
         DateTime.Now.Minute * 3600000)
  PageID.Value = R.Next()
End If


So by this method you can identify each tab request as unique requests. But it has following two disadvantages.

First: The access of hidden element PageID is only when ViewState is restored on postback. So you cannot access PageID in page_init().
Second: As hidden field is accessible to the visitor, anyone can change PageID. So this solution will work only for environment with 100% trust ratio of all user.



UPDATE:
A good blog entry for same using Route: Get an unique session in each browser tab[^]
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900