Create a class
Csharp code
Copy codeThe Code is as follows: using System;
Using System. Web;
Using System. Web. UI;
Using System. Web. SessionState;
Public class mana_session: Page
{
Public mana_session ()
{
}
Protected override void OnInit (EventArgs e)
{
If (Session ["uid"] = null | Session ["uid"]. ToString () = "")
{
Response. Redirect ("login.htm ");
}
}
}
Copy codeThe Code is as follows: using System;
Using System. Web;
Using System. Web. UI;
Using System. Web. SessionState;
Public class mana_session: Page
{
Public mana_session ()
{
}
Protected override void OnInit (EventArgs e)
{
If (Session ["uid"] = null | Session ["uid"]. ToString () = "")
{
Response. Redirect ("login.htm ");
}
}
}
In the cs file of the page to determine the session, this file inherits from the base class mana_session.
For example
Csharp code
Public partial class Index: mana_session