1

In one ASP.NET application, we provide a link to open another application. If user clicks on that hyper link, another application will open in new window. The problem is both the applications are using the same session. Is there any way to change the session ID for the new window?

I have already tried abandoning session and clearing sessionID cookie in page load. But it is creating new session id and again both window are accessing the new Session ID. I want to have separate session ID for the two windows.

Is there any way to do that?

sabaedge
  • 79
  • 2
  • 10
  • If you don't care about your URLs you could try [Cookieless Sessions](http://msdn.microsoft.com/en-us/library/aa479314.aspx), but there's probably a more correct way to do this. – Roman Nov 17 '11 at 03:28
  • Possible Duplicate: http://stackoverflow.com/questions/2840615/asp-net-session-multiple-browser-tabs-different-sessions – Jon P Nov 17 '11 at 03:51
  • It sounds like you're using the wrong tool for the job and fighting against the grain. What are you trying to do that's making you want this behavior in the first place? – Dave Ward Nov 17 '11 at 03:54
  • we are having a view page in our application. all the parameters we pass to this page are done through session. so when we open the same page in new window, it is causing issue because both are using the same session. is there any way to clear the session id alone? so that each window will have different session. – sabaedge Nov 26 '11 at 02:54

4 Answers4

3

I don't think that there is a good way to do this when you are using Session. You may want to think about using Viewstate instead of session for the data that you do not want shared between the two windows.

xcopy
  • 2,248
  • 18
  • 24
0

Use sessionID. and place it in view state. Compare sessionid from view state to session id in session. If they are different its a new window create a new session and remember to upt the new id in view state

Max
  • 1
0

You can create session ID dynamically based on what application you are working on. When you open another application, you can create new sessions for second application using unique ID.

Vidya
  • 193
  • 1
  • 2
  • 14
0

Same question just using browser tabs instead. The same answer will work for you

asp.net - session - multiple browser tabs - different sessions?

Community
  • 1
  • 1
Jon P
  • 19,442
  • 8
  • 49
  • 72
  • This will put session id in url i don't want it in url. – sabaedge Nov 26 '11 at 03:25
  • 1
    @sabaedge that is not what the answer in the previous question is suggesting. What you need to so is make the session id you are using unique. This can be done with a random number or guid stored in a hidden variable or view state – Jon P Nov 26 '11 at 06:02