.net - HTTP Request only works in browser -


I have the following GET request that returns HTML for a login form, indicating that my authentication, i.e. wrong credentials When I authenticate in a browser session, and manually request the same URL, then I hope the blank XML document will be found as a response. What am I missing?

  var getRequest = WebRequest.Create ("http://frulo.com/v1/company/subscribers.xml") as HttpWebRequest; GetRequest.Credentials = New network credentials ("user@company.net", "password"); (Var response = getRequest.GetResponse () using HttpWebResponse) {var sr = New StreamReader (response.GetResponsestream ()); Response.Write (sr.ReadToEnd ()); }  

You already know the answer: when you get certified in a browser session What you get is the correct response means that you are not authenticated when using WebRequest .

Used for the credentials you provide, but your web site is used for some type of HTML form-based authentication.

To solve this problem, you must use the same authentication mechanism that the Web application makes, this cookie may be based, or a session ID passed with each request as POST or GET parameter can be done. Knowing more about the web site is difficult to provide even more support.

is related to the following question and you are most likely to help:


Comments

Popular posts from this blog

asp.net - Javascript/DOM Why is does my form not support submit()? -

sockets - Delphi: TTcpServer, connection reset when reading -

javascript - Classic ASP "ExecuteGlobal" statement acting differently on two servers -