ASP.NET窗体身份验证与Android浏览器 [英] ASP.NET Forms Authentication with Android Browser

查看:155
本文介绍了ASP.NET窗体身份验证与Android浏览器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用ASP.NET表单用一个简单的方法验证。身份验证使用cookie用于存储的凭据。

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

我preSS按钮表单的身份验证和我重定向到应用页面。

但是,Android浏览器我preSS按钮并没有什么。

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

 <身份验证模式=表格>
 <形式loginUrl =MLogin.aspx
     超时=30
     NAME =。MOBAUTH
     路径=/
     defaultUrl =Main.aspx
     无Cookie =自动检测>
  <凭证了passwordFormat =清除>
   <使用者名称=dev的密码=123456/>
  < /凭证>
 < /形式GT;
< /认证>
<授权>
 <拒绝用户=? />
< /授权>

没有人有任何想法可能发生的?

补充...

MLogin.aspx用一个简单的方法验证用户:

 私人无效身份验证()
{
    如果(FormsAuthentication.Authenticate(dev的,this.txtPass.Text.Trim()))
        FormsAuthentication.RedirectFromLoginPage(开发,真正的);    到Response.End();
}


解决方案

原因是到Response.End()。这个函数prematurely杀死你的数据流。没有必要为它在所有

不同的浏览器不同的方式处理该到Response.End()。有些人会渲染,即使你结束了流的网页,有的不会呈现它。

I'm using ASP.NET Forms Authentication with a simple way. The authentication use a cookie for store the credentials.

Works perfectly in browsers like: Desktop: Chrome, Safari, IE, ... Mobile: iPhone Browser, Opera Mobile ...

I press the button form's authentication and i redirect to the app page.

BUT, in Android browser i press the button and nothing.

The configuration of ASP.NET Forms Authentication is simple:

<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>

Does anyone have any idea what might be happening?

Complementing...

MLogin.aspx use a simple method for authenticate the user:

private void authenticate()
{
    if (FormsAuthentication.Authenticate("dev", this.txtPass.Text.Trim()))
        FormsAuthentication.RedirectFromLoginPage("dev", true);

    Response.End();
}

解决方案

The reason is the Response.End(). That function prematurely kills your stream of data. There is no need for it at all.

Different browsers handle the Response.End() in different ways. Some will render the page even though you ended the stream, and some will not render it.

这篇关于ASP.NET窗体身份验证与Android浏览器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆