Click here to Skip to main content
16,004,828 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
XML
<head>
    <script  runat="server">

        protected void Page_Load(object sender, EventArgs e)
        {
            if (String.IsNullOrEmpty(Request.QueryString["logoff"]) == false &&
                Request.QueryString["logoff"].ToLowerInvariant() == "true")
            {
                FormsAuthentication.SignOut();
                ErrorMessage.Text = "You have been signed out";
                ErrorMessage.Visible = true;
            }
        }
        protected void LogIn_Clicked(object sender, EventArgs e)
        {
            string username = Request.Form["username"];
            string password = Request.Form["password"];
            bool remember = RememberMe.Checked;

            if (FormsAuthentication.Authenticate(username, password))
            {
                FormsAuthentication.RedirectFromLoginPage(username, createPersistentCookie: remember);
            }
            else
            {
                ErrorMessage.Visible = true;
            }
        }


    </script>
Posted
Comments
Stephen Hewison 11-Jun-12 9:47am    
Is there a question to go with this code?
Ravi Tuvar 11-Jun-12 9:55am    
have you tried to Clean Solution and Rebuild it?

1 solution

what is the "createPersistentCookie: remember" parameter of RedirectFromLoginPage method?

write this:
C#
FormsAuthentication.RedirectFromLoginPage(username, remember);
 
Share this answer
 
Comments
nicky_008 11-Jun-12 10:10am    
end of statement expected for this line....error comes out... protected void Page_Load(object sender, EventArgs e)
nicky_008 11-Jun-12 10:11am    
and for this line "FormsAuthentication.SignOut();".....declaration expected...error message comes

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900