Check the login information in ASP.NET (using global procedures, original)

zhaozj2021-02-16  84

'Write in module1.vb, can be built by any page to create, test through' PCSKY original http://blog.9cbs.net/lee2001XPASP, you can also write in .NET, not recommended <% IF session ("UserName") <> "" "" Login.aspx ") end if%> ASP.NET is written in Module1.vbmodule Module1Sub Checkuser () 'Check User Information IF HTTPCONTEXT. Current.Session ("UserName") = "" Then httpContext.current.response.redirect ("login.aspx") end ifnd suend module to the page you need to verify: private sub page_load (Byval Sender as system.object , Byval e as system.eventargs) Handles mybase.load call checkuser () 'Check the login information END SUB Advantages: 1. Implement the separation of pages and code, improve performance 2. Code standardization, use global processes, reduce code redundancy examples Simple, I hope everyone can throw the jade! ^ _ ^

转载请注明原文地址:https://www.9cbs.com/read-14360.html

New Post(0)