dimanche 7 décembre 2014

.net WinForms WebBrowser resets headers on redirect


Vote count:

0




An internal webserver requires me to supply a custom http header in order to access the webpages. This works fine the most part but if the html or javascript starts a redirect or uses an AJAX request it doesn't use my headers anymore.


Is there some way to change this behaviour so it always sends my custom header?



private void Form1_Load(object sender, EventArgs e)
{
webBrowser1.Navigate("http://localhost/test.php", null, null, "User-Agent: Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2228.0 Safari/537.36\r\nSomething-Custom: TestValue");
}


Javascript code in the php file:



<script>
window.location="?redirect";
</script>


The first requests received my header 'Something-Custom', while the second request with ?redirect doesn't. I also added the user-agent to verify that it indeed resets all headers.



asked 1 min ago







.net WinForms WebBrowser resets headers on redirect

Aucun commentaire:

Enregistrer un commentaire