Last active
September 11, 2019 16:35
-
-
Save vwmberry95/2471c7bb9bc74ab285ef9befa66a8e5b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class RequestHandler : DefaultRequestHandler | |
{ | |
public SignInForm SignIn { get; private set; } | |
public override bool GetAuthCredentials(IWebBrowser browserControl, IBrowser browser, IFrame frame, bool isProxy, string host, int port, string realm, string scheme, IAuthCallback callback) | |
{ | |
try | |
{ | |
using (this.SignIn = new SignInForm(host)) | |
{ | |
if (this.SignIn.ShowDialog() == DialogResult.OK) | |
{ | |
callback.Continue(this.SignIn.Username, this.SignIn.Password); | |
return true; | |
} | |
} | |
} | |
catch (Exception ex) | |
{ | |
Console.Write("ERROR (GetAuthCredentials): " + ex.Message); | |
} | |
finally | |
{ | |
callback.Dispose(); | |
} | |
return false; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment