c# - HttpWebRequest to pretend like a browser request? -
I have some code (in a Winform app) that is For some reasons, it recently starts returning to the internal error of 500 when requested from my app. The problem is I have no control over their code, I do not know what it does on the backend which is caused by breaking it while requesting my app. Is there any way, Chrome? (Only To avoid error) Set the value of the browser's user agent. HttpWebRequest.GetResponse () Reads using.
(In response there are some HTML for navigation, but not in Firefox / Chrome / IE, it is still returning 200 .
HTTP Webbet WebRequest = (HTTP WebBarm) WebRequest. Create ("http://example.com"); WebRequest.UserAgent = @ " Mozilla / 5.0 (Windows NT 6.2; Win64; x64) AppleWebKit / 537.36 (KFTM, like Gecko) Chrome / 32.0.1667.0 Safari / 537.36 ";
Comments
Post a Comment