c# - ASP.NET Session & Master Page -
i have created masterpage.aspx , other pages.i want if user click on mainpage anywhere on link
or button
without login
must redirect login.aspx.
how can create session
?.i need idea weather code in masterpage.cs page_load method
or elsewhere ?.
masterpage.aspx
{
//code here
}
login.aspx
{
//code here
}
use condition on master page:
if (session["loggedusername"] == null && !request.path.endswith("login.aspx")) { response.redirect("~/your/path/login.aspx"); }
you can use: membershipprovider
this can see here:
check session variable , redirect login page before page load
Comments
Post a Comment