2010-11-09 35 views
3

我以简单的方式使用ASP.NET窗体身份验证。身份验证使用cookie来存储凭据。使用Android浏览器进行ASP.NET窗体身份验证

作品在浏览器中完美地想: 桌面:Chrome浏览器,Safari浏览器,IE,... 手机:iPhone浏览器,Opera移动...

我按下按钮形式的认证,我重定向到应用页面。

但是,在Android浏览器中,我按下按钮,没有任何东西。

ASP.NET的配置表单验证很简单:

<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(); 
} 
+1

是使用标准logincontrol的MLogin.aspx?你在这里所有的是配置,页面本身呢? – Artemiy 2010-11-09 14:55:57

回答

1

原因是到Response.End()。该功能会过早杀死您的数据流。根本没有必要。

不同的浏览器以不同的方式处理Response.End()。即使你结束了流,有些会渲染页面,有些不会渲染它。

0

检查响应的Set-Cookie标题字段中的“expires”参数,并确保您的手机设置为正确的时间&日期。如果浏览器认为cookie已经过期,它将不会存储它。

相关问题