Hi, I have created a button click event for logout on masterpage.
I have to click twice the button get redirected to desired page.
protected void btnLogout_Click(object sender, EventArgs e)
{
Session.Abandon();
Session["StaffID"] = null;
Session["User"] = null;
Session.RemoveAll();
Response.Clear();
Response.Redirect("~/Logout");
}
7 Replies
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.

Rajeesh MenothPosted Jul 23, 2015, 8:19 AM
Sheikh parvazPosted Jul 23, 2015, 8:04 AM
Sheikh parvazPosted Jul 23, 2015, 6:12 AM
I did that as well but in vain. I have tried almost all tricks and searched answers on net. It needs some expert to answer.
Raja TPosted Jul 23, 2015, 4:48 AM
Rajeesh MenothPosted Jul 23, 2015, 4:38 AM
Sheikh parvazPosted Jul 23, 2015, 4:29 AM
Rajeesh MenothPosted Jul 23, 2015, 4:23 AM