Quantcast
Channel: Visual C# forum
Viewing all articles
Browse latest Browse all 31927

Webclient not working with NTLM or basic authentication

$
0
0

Hi,

i am creating a c sharp desktop application, in this project i am using web client method 

i am also setting some credentails before sending request, but i do not know whats the reason , authentication always fails

CredentialCache cc =newCredentialCache();
cc.Add(newUri("http://myserver:port/v1/pc.apsx"),"NTLM",newNetworkCredential("username","pass","domain"));
client.Credentials= cc;

using(WebClient client =newWebClient())

{
                client.Credentials= cc;

client.downloadstring(new Uri("http://myserver:port/v1/pc.aspx"));

}

i am not sure what is wrong i am doing, what authentication should i set in IIS server for this and do i need to set any other authentication mode  other than windows? even trying basic authentication do not work.

one more question can we present the challenge diolog box by while authenticating through webclient method, just like when browser check if there is unauthorised user then it come with that dilaog box asking for user name and password. 


Viewing all articles
Browse latest Browse all 31927

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>