开发者

Silverlight 4, Google Chrome, and HttpWebRequest problem

My Silvrlight 4 application hosted in ASP.NET MVC 2 working fine when used through Internet Explorer 8, both in development server and remote web server (IIS 6.0). However when I try to browse through Google Chrome (version 5.0.375.70) it throws "remote server returned not found" error. The code causing the problem is the following:

public class MyWebClient
{
  private HttpWebRequest _request;
  private Uri _uri;
  private AsyncOperation _asyncOp;

  public MyWebClient(Uri uri)
  { 
    _uri = uri; 
  }

  public void Start(XElement data)
  {
    _asyncOp = AsyncOperationManager.CreateOperation(null);
    _data = data;
    _request = (HttpWebRequest)WebRequest.Create(_uri);
    _request.Method = "POST";
    _request.BeginGetRequestStream(new AsyncCallback(BeginRequest), null);
  }

  pri开发者_开发技巧vate void BeginRequest(IAsyncResult result)
  {
    Stream stream = _request.EndGetRequestStream(result);
    using (StreamWriter writer = new StreamWriter(stream))
    {
      writer.Write(((XElement)_data).ToString());
    }
    stream.Close();
    _request.BeginGetResponse(new AsyncCallback(BeginResponse), null);
  }

  private void BeginResponse(IAsyncResult result)
  {
    HttpWebResponse response = (HttpWebResponse)_request.EndGetResponse(result);
    if (response != null)
    {
       //process returned data
        ...
    }
  }
  ...
 }

In short, the above code sends some XML data to web server (to ASP.NET MVC controller) and gets back a processed data. It works when I use Internet Explorer 8. Can someone please explain what is the problem with Google Chrome?


I found the problem is related to ASP.NET MVC route handling with Google Chrome so opened a new question:

ASP.NET MVC routing issue with Google Chrome client

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜