Use the user control whelogined. ascx, Code As follows:
Namespace Hezjs. webform. modules. ascx
{
Using System;
Using System. Data;
Using System. drawing;
Using System. Web;
Using System. Web. UI. webcontrols;
Using System. Web. UI. htmlcontrols;
/**/ /// <Summary>
///A summary of modwhelogined.
/// </Summary>
Public Class Modwhelogined: system. Web. UI. usercontrol
{
Private Void Page_load ( Object Sender, system. eventargs E)
{
// Place user code here to initialize the page
String Strpath = Hezjs. webform. wffunction. siteurl ( This . Parent. Page) + " Modules/aspx/modlogin. aspx " ;
If ( This . Session [ " Transfer page " ] = Null )
This . Session. Add ( " Transfer page " , This . Parent. Page. Request. rawurl );
Else
This . Session [ " Transfer page " ] = This . Parent. Page. Request. rawurl;
If ( This . Session [ " User " ] ! = Null )
{
If (Hezjs. SYS. sysuser) This . Session [ " User " ]). Logined)
{
//Determine Permissions
//Specify a style
}
Else
{
This. Response. Redirect (strpath );
}
}
Else
This . Response. Redirect (strpath );
}
Code generated by web Form Designer # Region Code generated by web Form Designer
Override Protected Void Oninit (eventargs E)
{
//
//Codegen: This call is required by the ASP. NET web form designer.
//
Initializecomponent ();
Base. Oninit (E );
}
/**/ /// <Summary>
///The designer supports the required methods-do not use the code editor
///Modify the content of this method.
/// </Summary>
Private Void Initializecomponent ()
{
This. Load+ = NewSystem. eventhandler (This. Page_load );
}
# Endregion
}
}
Strpath is used to specify the system logon interface. The hezjs. webform. wffunction. siteurl () method is used to return the website address.
Address of the page for storing user requests in session ["transfer page "]
Session ["user"] stores a hezjs. SYS. sysuser object, which includes a logined member to return whether the user has logged on
Drag and Drop the user control directly to each page for Logon. When a user requests this page, if the user is not logged on, the user will go to the logon page. If the user has logged on, the user will be browsed normally.
Is it convenient?
You can also judge the permission of the Request page and specify the general style of the page (if no style is specified in advance) in the area marked by the code above ).