Здравствуйте!
Почему не сохраняются куки для автовхода? Что я сделал не так как надо?
код:
protected void btnLogin_Click(object sender, EventArgs e)
{
if (!IsValid) return;
var udc = new UserDbController();
int userId = udc.IsUserExists(tbLogin.Text, tbPassword.Text);
if (userId != -1)
{
Session["userId"] = userId;
Session["userLogin"] = tbLogin.Text;
FormsAuthentication.RedirectFromLoginPage(tbLogin.Text, chkbRememberLogin.Checked);
}
else
{
lblError.CssClass = "err";
lblError.Text = "Invalid password - try again, please!<br />";
}
}
config:
<authentication mode="Forms">
<forms name="WebSiteCookie"
loginUrl="Login.aspx"
timeout="20"
slidingExpiration="true"
cookieless="AutoDetect"
protection="All"
requireSSL="false"
enableCrossAppRedirects="false"
defaultUrl="Default.aspx"
path="/" />
</authentication>