Click here to Skip to main content
15,884,298 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I Have a problem with my project ,

I wish ,after running my project ,it's redirect into login page,

but when i running my project its redirect into Site.Master.aspx

What I have tried:

this is my code

in Site.Master.aspx

protected void Page_Load(object sender, EventArgs e)
       {
           if (Session == null)
           {
               Response.Redirect("View/Login.aspx");
           }
       }
Posted
Updated 28-Apr-20 21:53pm

1 solution

If you set Forms Auth you get that automatically.

Session will always be defined...instead check for some value you set after login. Something like

In login.aspx AFTER success
Session["loggedIn"] = true;


In Page_Load wherever
if ((bool)Session["loggedIn"] == true)
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900