Guest User

Untitled

a guest
Jun 18th, 2018
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.04 KB | None | 0 0
  1. <sessionState
  2. cookieless="UseCookies"
  3. regenerateExpiredSessionId="true"
  4. mode="InProc"
  5. timeout="20"/>
  6.  
  7. <pages enableSessionState="true">
  8.  
  9. <pages enableSessionState="true">
  10. <namespaces>
  11. <add namespace="..."/>
  12. </namespaces>
  13. </pages>
  14.  
  15. Sub Session_Start(ByVal sender As Object, ByVal e As EventArgs)
  16. ' Fires when the session is started
  17. End Sub
  18.  
  19. Sub Session_End(ByVal sender As Object, ByVal e As EventArgs)
  20. ' Fires when the session ends
  21. End Sub
  22.  
  23. public class MySession
  24. {
  25. public static void Add(string key, object value)
  26. {
  27. if (HttpContext.Current.Session != null && (HttpContext.Current.Session.Keys == null || (HttpContext.Current.Session.Keys != null && HttpContext.Current.Session[key] == null)))
  28. {
  29. HttpContext.Current.Session.Add(key, value);
  30. }
  31. }
  32.  
  33. public static void Remove(string key)
  34. {
  35. ...
  36. }
  37.  
  38. public static void Update(string key, object value)
  39. {
  40. ...
  41. }
  42.  
  43. public static object GetValue(string key)
  44. {
  45. ...
  46. }
  47. }
Add Comment
Please, Sign In to add comment