Advertisement
Guest User

Untitled

a guest
Nov 27th, 2014
156
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.32 KB | None | 0 0
  1. <sessionState mode="InProc" timeout="1" />
  2.  
  3. Sub Session_End(ByVal sender As Object, ByVal e As EventArgs)
  4. Response.Redirect("Login.aspx")
  5. End Sub
  6.  
  7. Response is not available in this context.
  8.  
  9. Protected Sub Page_Init(sender As Object, e As EventArgs)
  10. If Context.Session IsNot Nothing Then
  11. If Session.IsNewSession Then
  12. Dim newSessionIdCookie As HttpCookie = Request.Cookies("ASP.NET_SessionId")
  13. If newSessionIdCookie IsNot Nothing Then
  14. Dim newSessionIdCookieValue As String = newSessionIdCookie.Value
  15. If newSessionIdCookieValue <> String.Empty Then
  16. ' This means Session was timed Out and New Session was started
  17. Response.Redirect("Login.aspx")
  18. End If
  19. End If
  20. End If
  21. End If
  22. End Sub
  23.  
  24. protected void Page_Init(object sender, EventArgs e)
  25. {
  26. if (Context.Session != null)
  27. {
  28. if (Session.IsNewSession)
  29. {
  30. HttpCookie newSessionIdCookie = Request.Cookies["ASP.NET_SessionId"];
  31. if (newSessionIdCookie != null)
  32. {
  33. string newSessionIdCookieValue = newSessionIdCookie.Value;
  34. if (newSessionIdCookieValue != string.Empty)
  35. {
  36. // This means Session was timed Out and New Session was started
  37. Response.Redirect("Login.aspx");
  38. }
  39. }
  40. }
  41. }
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement