-
November 28th, 2014, 04:22 PM
#1
How to Handle Redirects to Login When Trying to Read Results From HttpWebRequest?
I am trying to retrieve results from url1, but it redirects me to a Https login page (url2) then later redirects me back to url1 to see the results. GetResponse ends up returning the html of the login page instead of the the url1 that I intended to get results from.
Here's how I am currently attempting to make the web requests.
Code:
string url1 = "http://somesite.net/results";
var httpWebRequest = (HttpWebRequest)WebRequest.Create(url1);
httpWebRequest.Headers.Add("Authorization", "Basic " + auth);
httpWebRequest.ContentType = "application/x-www-form-urlencoded";
httpWebRequest.Method = "GET";
Is there a way that I can handle the redirect to the login page so I can pull the right data? I have tried using CookieContainer, and CredentialCache doesn't seem to work with this site for some reason.
Thanks for taking the time to look over this, and please let me know if I need to provide any additional information.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|