2
Reply

log out based on parameter url

ceci bela

ceci bela

Oct 5 2012 12:41 PM
1.2k
hi, am new in c# and  need some help. I want to log out users based on url parameter eg localhost/?parameter=logoutaction.

The code below seem to be working but want to make sure this is the correct of doing it.
 protected void Page_Load(object sender, EventArgs e)
{
        String querystr = Request.QueryString["action"];
        if (querystr == "logoutUsers")
        {        
                FormsAuthentication
.SignOut();
          Session.Abandon();
   
FormsAuthentication.RedirectToLoginPage();
   
Response.End;
       
     }
}
Thanks a bunch.

Ceci

Answers (2)