Hello, can you post some code? I don't have Mac at hand, but I did a very simple test with Safari 3.1.2 on Windows. Although Safari on Windows is not supported yet, this scenario works fine for me.
shanaolanxing - I'll transfer to the Windows Azure team, and will have limited time to participate in the Silverlight forum. Apologize if I don't answer your questions in time.
bkejser
Member
6 Points
32 Posts
Safari and http web request headers
Jul 09, 2008 12:00 AM | LINK
Hi
I'm using Silverlight 2 beta 2.
The following code adds headers on IE and Firefox but not on Safari.
HttpWebRequest httpWebRequest;
// create object, set attributes etc
httpWebRequest.Headers["somename"] = "somevalue";
Yi-Lun Luo -...
All-Star
25149 Points
2759 Posts
Microsoft
Re: Safari and http web request headers
Jul 10, 2008 08:29 AM | LINK
Hello, can you post some code? I don't have Mac at hand, but I did a very simple test with Safari 3.1.2 on Windows. Although Safari on Windows is not supported yet, this scenario works fine for me.
I simply wrote this in Default.aspx:
protected void Page_Load(object sender, EventArgs e)
{
string value = Request.Headers["somename"];
Response.Clear();
Response.Write("Hello: " + value);
Response.End();
}
And here's the Silverlight code:
HttpWebRequest req = (HttpWebRequest)HttpWebRequest.Create(new Uri("http://localhost/RequestHeaderWeb/Default.aspx"));
req.Headers["somename"] = "somevalue";
req.BeginGetResponse(new AsyncCallback((result) =>
{
HttpWebResponse resp = (HttpWebResponse)req.EndGetResponse(result);
string returnedValue;
using (Stream stream = resp.GetResponseStream())
{
using (StreamReader reader = new StreamReader(stream))
{
returnedValue = reader.ReadToEnd();
}
}
this.Dispatcher.BeginInvoke(new Action(() =>
{
tb.Text = returnedValue;
}));
}), null);