Wednesday, February 17, 2010

Session value changes or clear on window .open

I have the same problem i.e, Session is not present whenever i call window.open.

When i check this problem more closely then i find that ASP.NET_SessionId cookie is not passed to new window.

There fore i pass the SessionID in Query String in window.open like,

window.open('http://abc.com/s.aspx?SASID=" & Session.SessionID &','V');

and put this in global.asax



Private Sub Application_PostMapRequestHandler(ByVal sender As Object, ByVal e As EventArgs)
If (Request.Cookies("ASP.NET_SessionId") Is Nothing) AndAlso (Request.QueryString("SASID") IsNot Nothing) Then
Request.Cookies.Add(New HttpCookie("ASP.NET_SessionId", Request.QueryString("SASID")))
End If
End Sub

No comments:

Post a Comment