Hi friends,
I am designing a log in page. It contains user name and password fields, and a submit button.
So user enters user id, password and clicks submit button and he will be logged in. He will be redirected to inbox page.
Now if he click the logout button, he will be logged out and will be redirected to login page.
This is the scenario.
But my problem is after user cliked logout button, if he clicks back,forward buttons in Internet Explorer, he is still able to log in automatically.
Infact my session creation approach may be very wrong. Please correct me
My code is here
Default.aspx :
protected void Button1_Click(o bject sender, EventArgs e)
{
if (TextBox1.Text == "ravi" && TextBox2.Text == "programmer ")
{
Session["a"] = "session1";
Response.Redire ct("Default2.as px");
}
}
Default2.aspx :
protected void Page_Load(objec t sender, EventArgs e)
{
if (Session["a"] == null)
{
Response.Redire ct("Default.asp x");
}
else
{
Response.Write( "welcome to page");
}
}
protected void Logout_Click(ob ject sender, EventArgs e)
{
Session.Remove( "a");
Response.Redire ct("Default.asp x");
}
I am designing a log in page. It contains user name and password fields, and a submit button.
So user enters user id, password and clicks submit button and he will be logged in. He will be redirected to inbox page.
Now if he click the logout button, he will be logged out and will be redirected to login page.
This is the scenario.
But my problem is after user cliked logout button, if he clicks back,forward buttons in Internet Explorer, he is still able to log in automatically.
Infact my session creation approach may be very wrong. Please correct me
My code is here
Default.aspx :
protected void Button1_Click(o bject sender, EventArgs e)
{
if (TextBox1.Text == "ravi" && TextBox2.Text == "programmer ")
{
Session["a"] = "session1";
Response.Redire ct("Default2.as px");
}
}
Default2.aspx :
protected void Page_Load(objec t sender, EventArgs e)
{
if (Session["a"] == null)
{
Response.Redire ct("Default.asp x");
}
else
{
Response.Write( "welcome to page");
}
}
protected void Logout_Click(ob ject sender, EventArgs e)
{
Session.Remove( "a");
Response.Redire ct("Default.asp x");
}
Comment