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

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

ios - Change Storyboard View using Seague -