how to force username & password while accesing http url instead of "defaultcredentials"

  • Thread starter Thread starter gujarsachin2001
  • Start date Start date
G

gujarsachin2001

hello friends
i m connecting to http or https url programatically through console
application using follwoing methods of credentilas but if there is
username & password for that url through this code I m able to download

files from that url using "DefaultCredentials" but i want to use
password and username to access resources if tht url contains. & if for

tht specific url if user enters wrong username & password so tht he
must not able to acess tht files from tht url.

WebClient request= new WebClient();
request.Credentials=CredentialCache.DefaultCredentials;


so is thrre any method to replace "DefaultCredentials" & I can use
password & usename of tht url so my application will be more safe.


thanks,
Sachin
 
Thus wrote (e-mail address removed),
hello friends
i m connecting to http or https url programatically through console
application using follwoing methods of credentilas but if there is
username & password for that url through this code I m able to
download

files from that url using "DefaultCredentials" but i want to use
password and username to access resources if tht url contains. & if
for

tht specific url if user enters wrong username & password so tht he
must not able to acess tht files from tht url.

WebClient request= new WebClient();
request.Credentials=CredentialCache.DefaultCredentials;
so is thrre any method to replace "DefaultCredentials" & I can use
password & usename of tht url so my application will be more safe.

Sending DefaultCredentials is all but useless for accessing Internet resources.

Depending on the type of authentication used by the web site, you either
set HttpWebRequest.Credentials to a NetworkCredentials object or send user
name and password as URL-encoded string as form data.

Cheers,
 
Back
Top