Quantcast
Channel: Web Forms
Viewing all articles
Browse latest Browse all 23244

Login

$
0
0

i wrote this code for the login control

protected void Login1_Authenticate(object sender, AuthenticateEventArgs e)
{
AdminDetails detail = Login.LoginAdmin(Login1.UserName, Login1.Password);
if (detail.username != null)
{
FormsAuthentication.Initialize();
FormsAuthenticationTicket tkt = new FormsAuthenticationTicket(1, detail.username.ToUpper(), System.DateTime.Now,
System.DateTime.Now.AddHours(1000), Login1.RememberMeSet, "Admin", FormsAuthentication.FormsCookiePath);

string enc = FormsAuthentication.Encrypt(tkt);
HttpCookie cookie = new HttpCookie(FormsAuthentication.FormsCookieName,enc);
Response.Cookies["adminid"].Value = detail.adminid;
if (tkt.IsPersistent)
{
cookie.Expires = tkt.Expiration;
Response.Cookies["adminid"].Expires = tkt.Expiration;

}
Response.Cookies.Add(cookie);
string returnUrl = Request.QueryString["ReturnUrl"];
if (returnUrl != null)
{
Response.Redirect(returnUrl);
}
else
{
Response.Redirect("~/Admin/Default.aspx");
}
}

}

but when i try to login it says

Your login attempt was not successful. Please try again.

i need help!!


Viewing all articles
Browse latest Browse all 23244

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>