c# - HttpWebRequest to pretend like a browser request? -


I have some code (in a Winform app) that is HttpWebRequest.GetResponse () Reads using.

For some reasons, it recently starts returning to the internal error of 500 when requested from my app.
(In response there are some HTML for navigation, but not in Firefox / Chrome / IE, it is still returning 200 .

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.

  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

Popular posts from this blog

c - Mpirun hangs when mpi send and recieve is put in a loop -

python - Apply coupon to a customer's subscription based on non-stripe related actions on the site -

java - Unable to get JDBC connection in Spring application to MySQL -