3

I am able to successfully login to owamail and I get authentication cookies as well. I perform a search request on owamail for which I get 400 bad request on the httpwebresponse. Below is the search HTTP post request which is xmlhttprequest as per the browser.

Request Parameters =<params><canary>value</canary><st><FVLVS few parameters />....etc

Request Details:

HttpWebRequest Request = (HttpWebRequest)WebRequest.Create("https://owamail.mysite.net/OWA/ev.owa?Oeh=1&ns=MsgVLV2&ev=LoadFresh&pfmk=M23:11111111")
Request.method= post
Request.keepalive=false
Request.contenttype= "text/plain;charset=UTF-8";
Request.protocolversion= httpversion.version10
Request.allowautoredirect=true
Request.proxy=null
Request.timeout=800000
Request.readwritetimeout=800000
Request.User agent="Mozilla/4.0 (compatible; MSIE 8.0; windows NT 6.0; wow64;" "Trident/4.0; SLCC1; NET CLR 2.0.50727; media center pc 5.0;"
Request.header.add("accept-encoding", "gzip, deflate");
Request.contentlength= data1.length

1 Answers1

0

First, cast the WebRequest to an HttpWebRequest like this

HttpWebRequest request= (HttpWebRequest)HttpWebRequest.Create(@"https://owamail.mysite.net/OWA/ev.owa?Oeh=1&ns=MsgVLV2&ev=LoadFresh&pfmk=M23:11111111");

Then, add this line of code: (**Note Useragent will be differ based on OS compatibility)

request.UserAgent = "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322; .NET CLR 2.0.50727)";

https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/User-Agent/Firefox visit this link to know about the user agent string reference that Mozilla supports.