Log out - for authentication mode="Forms" [Resolved]

Posted by Nerdanalysis under ASP.NET on 3/25/2012 | Points: 10 | Views : 4013 | Status : [Member] | Replies : 5
hi all,

How to make the log out control where we use the " authentication mode="Forms" " in web.config file. I used the session management as well.

in web.config file :-

<authentication mode="Forms">
<forms name="RCSI" defaultUrl="~/User/MyHomePage.aspx" loginUrl="~/Common/Login.aspx" >
</forms>
</authentication>

in login file:-
protected void btnSubmit_Click(object sender, EventArgs e)
{
SqlDataReader dr;
dr = obl.drrr("exec usp_login3 '" + txtUsername.Text + "','" + txtPassword.Text + "','" + true + "'");
if (dr.Read())
{
Session["username"] = txtUsername.Text;
FormsAuthentication.RedirectFromLoginPage(txtUsername.Text, true);
Response.Write(Session["username"].ToString());
}
else
{
lblMsg.Text = "Incorrect password or not verified";
lblMsg.Visible = true;
Panel2.Visible = true;
}
}




Responses

Posted by: Patel28rajendra on: 3/26/2012 [Member] Starter | Points: 50

Up
0
Down

Resolved
Hi

you should use
FormsAuthentication.SignOut() method for more refer this link

http://msdn.microsoft.com/en-us/library/system.web.security.formsauthentication.signout.aspx

R D Patel

Nerdanalysis, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Patel28rajendra on: 3/26/2012 [Member] Starter | Points: 25

Up
0
Down
Hi

you should visit this link and follow steps give in it

http://www.asp.net/web-forms/tutorials/security/introduction/an-overview-of-forms-authentication-vb

R D Patel

Nerdanalysis, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Nerdanalysis on: 3/26/2012 [Member] Starter | Points: 25

Up
0
Down
Thanks dude and whats story with session management

Nerdanalysis, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Patel28rajendra on: 3/26/2012 [Member] Starter | Points: 25

Up
0
Down
Hi

you are Welcome

R D Patel

Nerdanalysis, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Patel28rajendra on: 3/26/2012 [Member] Starter | Points: 25

Up
0
Down
Hi

you can refer this link for session management

http://www.codeproject.com/Articles/7182/Session-management-options-in-ASP-NET

R D Patel

Nerdanalysis, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response