Wednesday, August 15, 2018

LogOut Button in asp.net C# | how to create logout Button | Sradha WebCreations

LogOut Button in asp.net C# 
 how to create logout Button

code for page load event 

 protected void Page_Load(object sender, EventArgs e)
    {     
        Response.Cache.SetCacheability(HttpCacheability.NoCache);
    }
Code for logout Button Click Event
Code for maste page 



       protected void lnk_Click(object sender, EventArgs e)
    {
        Session.Abandon();
        
        Response.Redirect("~/login.aspx");
    }

Code for maste page 


public partial class InMaster : System.Web.UI.MasterPage
{
    protected void Page_Load(object sender, EventArgs e)
    {     
        Response.Cache.SetCacheability(HttpCacheability.NoCache);
    }
    protected void lnk_Click(object sender, EventArgs e)
    {
        Session.Abandon();
        
        Response.Redirect("~/login.aspx");
    }
}


No comments:

Post a Comment