i need check if url exists , can reached. in order send request , handle status:
var httpclient = new httpclient(); var response = httpclient.getasync(new uri(pageurl)); ispageaccessible = response.result.statuscode == httpstatuscode.ok;
however, server uses ntlm authentication. found here, there several steps (requests) before success ok status. first request 401 unauthorized status , can't go further steps.
all in all, how can check url on server ntml upon completion of requests?
if accessing authenticated server, should provide credentials. credentials of running process ntlm can provided httpclient
below:
var handler = new httpclienthandler { credentials = system.net.credentialcache.defaultcredentials }; var httpclient = new httpclient(handler); var response = httpclient.getasync(new uri(pageurl));
Comments
Post a Comment