i create a two .aspx forms on first i have taken a linkbutton called login when anyone click on that a login form opens and when anyone give right login details and click on login button than that login link button should be change in logout button can it possible in ASP.NET with c#
i am not using Memberships controls like login or etc.
i have created my own sql tables...
pls help its urgent
Thanks
Chester !
Loading
Kirtan PatelPosted Nov 28, 2009, 2:35 AM
Here is Idea How you can toggle the same link button to Login And Logout
if my answer helps you then please check "do you like this answer checkbox" :)
protected void lnkLoginLogout_Click(object sender, EventArgs e)
{
if (Session["LoggedIn"] == null)
{
//Login Code Here
//After Success Full login
//Make Logged in in Session=1;
Session["LoggedIn"] = 1;
//Change the text of LinkButton to Logout
lnkLoginLogout.Text = "Logout";
}
else
{
//Logout the User if Already logged in
Session.Abandon();
FormsAuthentication.SignOut();
lnkLoginLogout.Text = "login";
Session["LoggedIn"] = null;
}
}
Lalit MPosted Nov 28, 2009, 2:23 AM
protected void Logoutbtn_Click(object sender, System.EventArgs e)
{
Response.Clear();
FormsAuthentication.SignOut();
Response.Redirect("Default.aspx");
}