C# Http Basic Authentication via SSL -
i have console application, , i'm trying make request , html of website. page try connect asks me authenticate http basic authentication, , page uses ssl certificate taken godaddy.com.
my code works great when try use code on new target url, returns http 401 (unauthorized) error.
i don't know problem i'm thinking it's related ssl or it's server-based error. know causing error?
here code:
servicepointmanager.servercertificatevalidationcallback = new system.net.security.remotecertificatevalidationcallback(validateremotecertificate);// returns true uri uri = new uri(@"the url makes me crazy"); httpwebrequest request = (httpwebrequest)webrequest.create(uri) httpwebrequest; var cache = new credentialcache(); cache.add(uri, "basic", new networkcredential("myuser", "mypass")); request.credentials = cache; httpwebresponse response = (httpwebresponse)request.getresponse();//bingo, here lovely 401
Comments
Post a Comment