Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Finally after a lot of testing and investigation and many resources on stack overflow I found out what is going on.</p> <p>The problem seems to be that the <code>httpwebrequest</code> don't handle the authentication when parts of the webseite requests credentials and some don't.</p> <p><strong>Background:</strong></p> <p>Our Site has its own session management and redirect to a login controller when no valid session is available. Only this login controller is set to NTLM authentication. </p> <p>This we made because we have a web site without NTLM auth at all (no 401, 302 request loops in IE!) and only validate once (and we handle authentication on different url to prevent the problem that IE stop posting data at non-authenticated sites => see <a href="http://support.microsoft.com/?id=251404" rel="nofollow noreferrer">http://support.microsoft.com/?id=251404</a>).</p> <p><strong>Solution:</strong></p> <p>I normally sent a request on my target page and the webserver redirect, authenticate and redirect back to the target. As the httpwebrequest don't handle this for any reason if I have my own credentials set (see above code of my question) I changed to code to authenticate once to my login controller and store the session in a cookie container.</p> <p>For all following request I don't autenticate at all anymore. I add the cookie container and my server gets a valid session. So I don't have to authenticate anymore. Sideeffect is better performance this way.</p> <p>Another tricky thing was that I not only use httpwebrequest, I also use a webform control. Therefor I found the solution to add my own cookie session here: <a href="https://stackoverflow.com/questions/4185171/use-cookies-from-cookiecontainer-in-webbrowser">Use cookies from CookieContainer in WebBrowser</a> (Thanks to Aaron who saved me a lot of trouble as well).</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload