views:

80

answers:

2

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.

+1  A: 

This doesn't directly answer your question, but I would suggest you try Fiddler, and look at the actual request that is being sent by the browser. Compare the differences and try to figure out what's going wrong (you can use the "Request Builder" tab in Fiddler to eh-hm, fiddle with the parameters).

Dean Harding
Thank you codeka. Fiddler rocks. I found the problem; Google Chrome puts "Content-Type: application/x-www-form-urlencoded" in the request header (encodes url) but IE doesn't do that. So, next question is how to disable url encoding in Chrome.
synergetic
A: 

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: http://blogs.msdn.com/b/silverlight_sdk/archive/2009/08/12/new-networking-stack-in-silverlight-3.aspx

synergetic