|
Choose to use session as authentication
I wrote a special page checkLogin.aspx as authentication,
The code behind is
if (Session["adminName"] != null)
{
}
else
{
Response.Redirect("login.aspx");
}
Then call on each page that requires authentication
Server.Execute("checkLogin.aspx");The authentication can be completed, but there is a problem
Controls such as dropdownlist cannot be returned, indicating that the page code is wrong, remove it
Server.Execute("checkLogin.aspx"); turned to normal afterwards, I don't know why.
Except for a piece of code authentication for each page, there is no other method, such as writing as a function, to facilitate modification of the authentication content. There is no such example. |
|