HTTPS C # Post?

Am I trying to log into the HTTPS site and then proceed to download the report using C # (its xml report)?

I managed to log in OK through cookies, etc. - but whenever I go to the link after logging in, my connection takes me to the "logged out" page?

Does anyone know what might cause this?

+2
source share
2 answers

Make sure that the CookieContainer that you use for your login is the same that you use when loading the actual report.

var cookies = new CookieContainer(); var wr1 = (HttpWebRequest) HttpWebRequest.Create(url1); wr1.CookieContainer = cookies; // do login here with wr1 var wr2 = (HttpWebRequest) HttpWebRequest.Create(url2); wr2.CookieContainer = cookies; // get the report with wr2 
+5
source

This can be any number of reasons. Have you reached the cookie to download? Did you pass the referrer URL?

The best way to check is to record a working HTTP request from Wireshark or any number of Firefox or Fiddler extensions.

Then try to recreate the request in C #

+2
source

Source: https://habr.com/ru/post/1286670/


All Articles