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

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -