hi h r u. I would like to say that , i could not do login and logout in asp.net c# master page
. I want to do when i clock loginbutton on webpage it will go on login page and show logout link and when i click logout link ,it will go
home page. pls give me asp.net in c# code.
Abhishek YadavPosted Jul 10, 2015, 10:47 AM
By looking at your question, I think you want that when you click on login button, user should redirect to Home page and Logout button should display and when you click on Logout button, you can redirect to Home page again. Please find below steps, i did this in my project.
Step1:
On Login Click Event store username or password in Session as shown below:
Session["username"] = txtloginUsername.Text;
Session["password"] = txtPassword.Text;
Step 2:
On HomePage set Logout button visibility to FALSE.
Step 3:
On Your Main Master Page write below code.
if (Session["username"] != null)
{
btnLogout.Visible = true;
}
This means, until your session is available you'll be able to see the logout button. If your session expires redirect user to Session expire page.
Step 4:
On Logout button Click Event write below code.
Session.RemoveAll();
FormsAuthentication.SignOut();
FormsAuthentication.RedirectToLoginPage();
Nilesh JadavPosted Jul 10, 2015, 8:01 AM
http://codemyne.net/articles/asp/creating-a-simple-registration-or-signup-and-login-or-signin-form-using-asp.net-and-sqlserver.aspx?visitid=171&type=2
Raja TPosted Jul 10, 2015, 7:43 AM