Sunday, 15 July 2012

.NET HttpClient gets 503(Service Unavailable) while WebClient gets 200(OK) -



.NET HttpClient gets 503(Service Unavailable) while WebClient gets 200(OK) -

i have issue trying responce message host using .net. url:

dim checkurl string = "http://sob.ru/prodazha-kvartir?p=1#results"

when i'm using webclient this:

dim client new webclient dim responcestring string = client.downloadstring(new uri(checkurl))

... valid html page, responce status 200(ok)

but want utilize httpclient:

dim hclient new httpclient(new httpclienthandler) dim responce httpresponsemessage = await hclient.getasync(checkurl) if responce.issuccessstatuscode responcestring = await responce.content.readasstringasync

in case responce statuscode = 503(service unavailable)

i don't utilize handlers or specified options, default, results different. may reason?

.net webclient httpresponse http-status-codes dotnet-httpclient

No comments:

Post a Comment