无法使用登录控制进入主页 [英] Cant go Home page by using Login Control
本文介绍了无法使用登录控制进入主页的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我使用登录控制登录,当我从我的本地电脑上运行它工作正常,但当我主持它然后它不能去我的home.aspx页面...
我的登录代码
i use Login control for login and when i run it from my local pc it works fine ,but when i host it then it can't go on my home.aspx page...
my login code
SqlParameter[] paramater = new SqlParameter[]
{
new SqlParameter("@User_Name",Login1.UserName),
new SqlParameter("@Password",Login1.Password)
};
SqlDataReader dr = (SqlDataReader)db.ExecuteReader("Login", paramater);
if (dr.HasRows)
{
dr.Read();
Session["Branch"] = dr["Branch"].ToString();
Session["user"] = dr["Id"].ToString();
dr.Close();
DropDownList ddyear = (DropDownList)Login1.FindControl("ddyear");
Session["year"] = ddyear.SelectedItem.Text;
FormsAuthentication.RedirectFromLoginPage(Login1.UserName, Login1.RememberMeSet);
}
web.config中的
in web.config
<authentication mode="Forms">
<forms defaultUrl="Home.aspx" loginUrl="LogIn.aspx" timeout="60"></forms>
</authentication>
推荐答案
对URL使用〜并增加超时时间如下:
use "~" with URL and increase the timeout as following:
<authentication mode="Forms">
<forms defaultUrl="~/Home.aspx" loginUrl="~/LogIn.aspx" timeout="2000"></forms>
</authentication>
请试试。
please try it.
这篇关于无法使用登录控制进入主页的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文