从.net 3.5升级到.net 4.0后,我们发现一些Safari浏览器无法交叉validation我们的网站。
经过大量调查,ASP.Net正确识别Safari浏览器是一个问题。 ASP.Net将一些Safari(可能还有其他基于AppleWebKit的浏览器)标识为Mozilla Version 0.0。 不支持cookies,框架,javascript等的浏览器.Net 3.5在识别这些浏览器时没有任何问题。
我们简化了一个简单的http处理程序(运行在一个vanilla 4.0网站上),它只返回请求者的浏览器function。
以下是一些无法识别的用户代理(它们被标识为Mozilla 0.0):
处理程序代码如下所示:
<%@ WebHandler Language="C#" Class="TemporaryHandler" %> using System; using System.Web; using System.Web.Security; public class TemporaryHandler : IHttpHandler { public bool IsReusable { get { return true; } } public void ProcessRequest(HttpContext context) { HttpBrowserCapabilities hbc = context.Request.Browser; context.Response.Write("Type=" + hbc.Type + "<br>"); context.Response.Write("Name=" + hbc.Browser + "<br>"); context.Response.Write("Version=" + hbc.Version + "<br>"); context.Response.Write("Major Version=" + hbc.MajorVersion + "<br>"); context.Response.Write("Minor Version=" + hbc.MinorVersion + "<br>"); context.Response.Write("Platform=" + hbc.Platform + "<br>"); context.Response.Write("Is Beta=" + hbc.Beta + "<br>"); context.Response.Write("Is Crawler=" + hbc.Crawler + "<br>"); context.Response.Write("Is AOL=" + hbc.AOL + "<br>"); context.Response.Write("Is Win16=" + hbc.Win16 + "<br>"); context.Response.Write("Is Win32=" + hbc.Win32 + "<br>"); context.Response.Write("Supports Tables=" + hbc.Tables + "<br>"); context.Response.Write("Supports cookies=" + hbc.Cookies + "<br>"); context.Response.Write("Supports VBScript=" + hbc.VBScript + "<br>"); context.Response.Write("Supports Frames=" + hbc.Frames + "<br>"); context.Response.Write("Supports JavaScript=" + hbc.EcmaScriptVersion.ToString() + "<br>"); context.Response.Write("Supports Java Applets=" + hbc.JavaApplets + "<br>"); context.Response.Write("Supports ActiveX Controls=" + hbc.ActiveXControls + "<br>"); context.Response.Write("User Agent=" + context.Request.UserAgent + "<br>"); } }
我们对互联网上不提及这个问题感到困惑。 看起来我们需要将浏览器定义添加到framework / config / browsers文件夹,或者添加到网站级别的App_Browsers文件夹中,但是我们需要调整浏览器定义以使.net 4.0网站正常运行。
任何人有任何这个问题的经验?