Hi friends, i have designed login page for the first time.
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(object sender, EventArgs e)
{
if (TextBox1.Text == "ravi" && TextBox2.Text == "programmer")
{
Session["a"] = "session1";
Response.Redirect("Default2.aspx");
}
}
Default2.aspx :
protected void Page_Load(object sender, EventArgs e)
{
if (Session["a"] == null)
{
Response.Redirect("Default.aspx");
}
else
{
Response.Write("welcome to page");
}
}
protected void Logout_Click(object sender, EventArgs e)
{
Session.Remove("a");
Response.Redirect("Default.aspx");
}