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

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
 
J

Joerg Jooss

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,
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top