We are seeing some Safari browsers failing to cross-authenticate our website after we upgrade to .NET 4.0 from .NET 3.5.
After much investigation, it turns out to be a problem with ASP.NET identifying the Safari browsers properly. ASP.NET identifies some Safari (possibly other WebKit-based browsers) as Mozilla Version 0.0. browsers that do not support cookies, frames, JavaScript, etc. .NET 3.5 does not have any problems identifying these browsers.
We have simplified testing down to a simple HTTP handler (running on a vanilla 4.0 website) that only returns the browser capabilities of the requestor.
Here are a few User-Agents that fail to be identified (they are identified as Mozilla 0.0):
Mozilla/5.0+(Macintosh;+U;+Intel+Mac+OS+X+10_5_8;+en-us)+AppleWebKit/533.19.4+(KHTML,+like+Gecko)+Version/5.0.3+Safari/533.19.4
Mozilla/5.0+(Macintosh;+U;+Intel+Mac+OS+X+10_6_2;+en-us)+AppleWebKit/531.9+(KHTML,+like+Gecko)
Mozilla/5.0+(Macintosh;+U;+Intel+Mac+OS+X+10_6_7;+en-us)+AppleWebKit/533.20.25+(KHTML,+like+Gecko)+Version/5.0.4+Safari/533.20.27
Mozilla/5.0+(Macintosh;+U;+Intel+Mac+OS+X+10_6_6;+en-us)+AppleWebKit/533.18.1+(KHTML,+like+Gecko)
The handler code looks like this:
<%@ WebHandler Language="C#" Class="PowershellTemporaryHandler" %>
using System;
using System.Web;
using System.Web.Security;
public class PowershellTemporaryHandler : 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>");
}
}
We are bewildered as to the lack of mention on the Internet about this problem. It seems that we need to add Browser defintions either to the framework/config/browsers folder or else to the App_Browsers folder at the website level, but it seems bizarre that we would need to tweak Browser definitions for a .NET 4.0 website to run properly.
Does anyone have any experience with this issue?