ceci bela

ceci bela

  • NA
  • 58
  • 12.6k

log out based on parameter url

Oct 5 2012 12:41 PM
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)