asp.net-mvcgoogle-chromecustom-model-binder

ASP.NET MVC routing issue with Google Chrome client


My Silverlight 4 app is hosted in ASP.NET MVC 2 web application. It works fine when I browse with Internet Explorer 8. However Google Chrome (version 5) cannot find ASP.NET controllers. Specifically, the following ASP.NET controller works both with Chrome and IE.

//[OutputCache(NoStore = true, Duration = 0, VaryByParam = "None")]
public ContentResult TestMe()
{
  ContentResult result = new ContentResult();
  XElement response = new XElement("SvrResponse", 
    new XElement("Data", "my data"));
  result.Content = response.ToString();
  return result;
}

If I uncomment [OutputCache] attribute then it works with IE but not with Chrome. Also, I use custom model binding with controllers, so if I write the following:

public ContentResult TestMe(UserContext userContext)
{
  ...
}

it also works with IE, but again not with Chrome which gives me error message saying that resource was not found. Of course, I configured IIS 6 for handling all requests via aspnet_isapi.dll and I have registered custom model binder in my web app's Global.asax inside Application_Start() method. Can someone explain me what might be the cause? Thank you.


Solution

  • Ok, I found a way to solve this problem. In my silverlight app I opted for using client stack instead of using default http stack.

    WebRequest.RegisterPrefix("http://", WebRequestCreator.ClientHttp);
    WebRequest.RegisterPrefix("https://", WebRequestCreator.ClientHttp);
    

    See also: Link