Skip to content

Instantly share code, notes, and snippets.

@vwmberry95
Last active September 11, 2019 16:35
Show Gist options
  • Save vwmberry95/2471c7bb9bc74ab285ef9befa66a8e5b to your computer and use it in GitHub Desktop.
Save vwmberry95/2471c7bb9bc74ab285ef9befa66a8e5b to your computer and use it in GitHub Desktop.
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