Using FileWebRequest

  • Thread starter Thread starter Guest
  • Start date Start date
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.
 
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.
 
Back
Top