'Written in module1.vb and can be called by any page
'Vs. NET 2003 setup, test passed
'Pcsky (Jin Ge) http://blog.csdn.net/lee2001xp
This can also be written in. net. It is not recommended
If SESSION ("username") "then
Response. Redirect ("login. aspx ")
End if
%>
ASP. NET written in module1.vb
Module module1
Sub checkuser () 'check user information
If httpcontext. Current. Session ("username") = "" then
Httpcontext. Current. response. Redirect ("login. aspx ")
End if
End sub
End Module
Add the following to the page for verification:
Private sub page_load (byval sender as system. Object, byval e as system. eventargs) handles mybase. Load
Call checkuser () 'to check logon information
End sub
Advantages:
1. Implement the page andCodeTo improve performance.
2. Code standardization, using global processes to reduce code Redundancy
The example is relatively simple. I hope you can give me some advice! Pai_^