c# - How to handle popup authentication? -
i'm new this, , don't have else ask. i'm attempting access webpage programmatically (c#) web-scrapping software. i've figured out process of using httpwebresponse , httpwebrequest classes perform login through web page form, have website has 2 stage login procedure.
the first login occurs via pop-up. no webpage loaded in background, pop-up dialog saying authentication required , prompts username , password.
after getting past first login, second login web form should able handle myself i've learned.
my question: how programmatically provide login information pop-up authentication request?
edit
just provide more information. fiddler gives host connect when attempting access website.
edit
i attempted use mreye's answer below, , though seemed me little further, still having hangups. gettin certificate issues, after google work found workaround adding following code:
servicepointmanager.servercertificatevalidationcallback += delegate(object sender, x509certificate certificate, x509chain chain, sslpolicyerrors errors) { return true; }; now i'm getting system.net.webexception value "the remove server returned error: (401) unauthorized." exception's status protocolerror, though haven't been able further. know username/password being provided valid.
all need asign networkcredential object credentials property of httpwebrequest object have created. example:
mywebrequest.credentials = new networkcredential("username","password"); depending on server connecting may need:
mywebrequest.preauthenticate = true;
Comments
Post a Comment