Quantcast
Channel: Visual C# forum
Viewing all articles
Browse latest Browse all 31927

"Navigation Canceled" using WebBrowser with Windows Server 2008 R2

$
0
0

I am using WebBrowser to hit a page on another site and run the javascript on the page. This is working perfectly fine for web pages that do not require authentication to access them. However, I have a web page behind forms authentication that I'd like to access.

On my local computer, this code works perfectly, for both secured and unsecured pages:

var br = new WebBrowser();
br.DocumentCompleted += browser_DocumentCompleted;
br.ScriptErrorsSuppressed = true;

string PostDataStr = "username=username&password=password"; 
byte[] PostDataByte = Encoding.UTF8.GetBytes(PostDataStr); 
string AdditionalHeaders = "Content-Type: application/x-www-form-urlencoded" + Environment.NewLine;

br.Navigate(url, "", PostDataByte, AdditionalHeaders);

But when I run the same code on our server (Windows Server 2008 R2), I get a "navigation canceled" response from the secured page when I inspect the WebBrowser.DocumentText (hence, though it authenticates properly, it's not redirecting to the right page after authentication). It runs perfectly fine for the unsecured page. I'm assuming there's some IE setting on my local box that is not set on the server, but after fiddling with Internet Options for hours, I'm no closer to figuring out what it is. What settings do I need to have set up on the server/IE so that it will work with secured pages?


Viewing all articles
Browse latest Browse all 31927

Trending Articles