3

I am working on my first windows forms app to use WebKit.Net. I need to connect to an https site and popup an authentication form. Using .Net's built in browser, the authentication form pops up automatically, but WebKit just drops me at the 401 Authentication error page, and I can't figure out how to make it authenticate. Any ideas?

Even if I can figure out how to do this in the core webkit library, I can then modify WebKit.Net to support it, but I can't even find that. I tried searching the chromium source to see how they handle it, but it was way over my head. Any help is appreciated.

~therealmitchconnors

UPDATE: WebKit.NET is built on WebKit's WinCairo port, which uses CFLite in place of Apple's closed CFNetwork dll. Evidently, CFLite does not support Authentication Challenge, which is the 'right' way to do this. So, I added some code in the WebResourceLoadDelegate to check for a username and password, and, if one was provided, but the header is not included, cancel that web request and re-call the navigate method, including the username and password. It's a really ugly hack, but it works. Check it out at webkitdotnet/therealmitchconnors.

Now to figure out how to close a question...

therealmitchconnors
  • 2,732
  • 1
  • 18
  • 36
  • It appears from this article [link](http://developer.android.com/reference/android/webkit/WebView.html) that the Android implementation of the WebView class includes a SetHTTPAuthentication method to do this with, but WebKit.Interop.WebViewClass does not include this method. Is this a different implementation of webkit? – therealmitchconnors Jun 07 '11 at 18:42
  • Well, I was able to use WebMutableRequest.setValue() to manually set the Authentication header in the WebBrowserCore.Navigate() method, but that is only called when the user navigates from the navigation bar. If a hyperlink is clicked, or a redirect fired, there is no way I can find to access the request object before it is sent. – therealmitchconnors Jun 10 '11 at 18:45
  • Do you have any idea whether is possible or not to read the HTTP headers in WebKit? http://stackoverflow.com/questions/10458961/get-http-headers-on-webkit-net – Juan May 05 '12 at 04:53
  • See my response in your linked question... – therealmitchconnors May 07 '12 at 19:12

1 Answers1

1

There is no way in the API to do this. See my update above for my workaround.

therealmitchconnors
  • 2,732
  • 1
  • 18
  • 36