Using FileWebRequest

G

Guest

Hello,

I am trying to have my C# program request a file from a Windows XP LAN peer,
but it keeps telling me that my logon is incorrect, either user name or
password. This is the simple code:

WebRequest request = new WebRequest( "\\\\main\\SharedDocs\\file.txt" );
request.Credentials = new NetworkCredential( "user_name", "password" );
WebResponse response = request.GetResponse( );

It always says Logon Failed. What are the secrets to simple LAN
authentication?

Both this machine and the target machine are in the same workgroup on the LAN.

Thanks,
Rich S.
 
K

Kevin Spencer

Try passing the computer name of the computer on which the credentials
exist, as the "Domain" parameter.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
You can lead a fish to a bicycle,
but you can't make it stink.
 

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