Reputation: 439
We have a website that allow firmware downloads.
Somwhere along the way it uses a StreamReader. For some unknown reason, some customer (In Israel) get a 400 Bad Request error. Everyone else do not get this error.
Any1 out there experienced the same thing ? Anyone got a clue ?
protected void Page_Load(object sender, EventArgs e)
{
string strURL = Request.Url.Host;
System.Net.WebRequest reqPT = System.Net.WebRequest.Create("http://" + strURL + "/Products/ProductTree.asp");
System.IO.StreamReader srPT = new System.IO.StreamReader(reqPT.GetResponse().GetResponseStream());
dvPT.Controls.Add(new LiteralControl(srPT.ReadToEnd()));
}
It crashes, for them only, at the new StreamReader.
Thank you !
UPDATE : We noticed that the customer is actually loosing the "www" in the address (strURL), wich cause the error. Why would someone, (clicking on the same link as the rest of the planet is) would loose the www ?? I'm seeing 2 differents behavior for the exact same code :S
Upvotes: 0
Views: 434
Reputation: 4392
Well with the HTTP 400 error the requested URL is probably invalid, and since the literals in your System.Net.WebRequest
look OK, my guess is your Israeli user is requesting the page using a different Request.Url.Host
than everyone else. Can you debug and verify the value of strUrl
?
Upvotes: 1