我正在以一种简单的方式使用ASP.NET Forms身份验证。身份验证使用cookie来存储凭据。
在以下浏览器中完美运行: 桌面:Chrome,Safari,IE,... 手机:iPhone浏览器,Opera Mobile ......
我按下按钮表单的身份验证,然后重定向到应用页面。
但是,在Android浏览器中,我按下按钮,没有任何内容。
ASP.NET Forms身份验证的配置很简单:
<authentication mode="Forms">
<forms loginUrl="MLogin.aspx"
timeout="30"
name=".MOBAUTH"
path="/"
defaultUrl="Main.aspx"
cookieless="AutoDetect">
<credentials passwordFormat="Clear">
<user name="dev" password="123456"/>
</credentials>
</forms>
</authentication>
<authorization>
<deny users="?" />
</authorization>
有没有人知道可能会发生什么?
...补充
MLogin.aspx使用一种简单的方法来验证用户身份:
private void authenticate()
{
if (FormsAuthentication.Authenticate("dev", this.txtPass.Text.Trim()))
FormsAuthentication.RedirectFromLoginPage("dev", true);
Response.End();
}
答案 0 :(得分:1)
原因是Response.End()。该功能过早地杀死了您的数据流。完全没有必要。
不同的浏览器以不同的方式处理Response.End()。有些人会渲染页面,即使你结束了流,有些也不会渲染它。
答案 1 :(得分:0)
检查响应的Set-Cookie标头字段中的“expires”参数,并确保将您的手机设置为正确的时间&amp;日期。如果浏览器认为cookie已经过了它的到期日期,它就不会存储它。