我的asp.net網(wǎng)站沒有用Session來判斷很重定向(覺得麻煩),用的是forms認(rèn)證,但是總是登陸正確也被重定位到登陸界面:Admin文件夾下web.config代碼為:
<configuration>??? <appSettings/>??? <connectionStrings/>? ??? <system.web>????? <authorization>??????? <deny users ="*"/>??????? <allow users ="admin" verbs ="*"/>????? </authorization>??? </system.web></configuration>
Login.aspx的后臺(tái)代碼為:
protected void btnLogIn_Click(object sender, EventArgs e)??? {??????? string UserName = txtUserName.Text.ToString().Trim();??????? string PassWord = txtPassWord.Text.ToString().Trim();??????? //驗(yàn)證碼??????? AccountEntity user = new AccountEntity();??????? user.Username = UserName;??????? user.Password = PassWord;??????? user = new Account().Login(user );??????? if (user != null)??????? {??????????? //是否有必要在此創(chuàng)建會(huì)話呢???????????? FormsAuthentication.RedirectFromLoginPage(UserName ,false? );??????????? Response.Redirect("Main.aspx");??????? }??????? else??????? {??????????? this.ClientScript.RegisterStartupScript(this.GetType(), "Message", "alert('用戶名或密碼錯(cuò)誤!')",true);??????????? return;??????? }??? }
其它頁面沒有控制重定位頁面。我知道問題很菜,但仍然希望友友們能夠花那么一丁點(diǎn)時(shí)間幫助我一下,非常感謝O(∩_∩)O~!
- 1 回答
- 0 關(guān)注
- 330 瀏覽
添加回答
舉報(bào)
0/150
提交
取消