Silverlight 4, Google Chrome, and HttpWebRequest problem
Posted
by synergetic
on Stack Overflow
See other posts from Stack Overflow
or by synergetic
Published on 2010-06-14T09:45:26Z
Indexed on
2010/06/14
9:52 UTC
Read the original article
Hit count: 212
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);
}
private 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?
© Stack Overflow or respective owner