how to use a session variable into a class?

  • Thread starter Thread starter Bob
  • Start date Start date
B

Bob

Hi,

in order to check the value of a session variable in each page, i want to
put the code into a shared sub like this:

Public Class myclass
Public Shared Sub checksession()
If Session("myvar") = "" Then
Response.Redirect("mypage.aspx")
End If
End Sub
End Class

and then using: myclass.checksession()

In code-behind, "Session" must not be defined, but here in the class, i get
the error that the "Session" is not defined.

Thanks for help
Bob
 
Back
Top