V
Vasko Peter
Hi All,
I am breaking my head on one problem. I'd like to read a file that is on a
different machine in intranet. The tricky part is that I do not want to
allow an access for EVERYONE but want to minimise it for my machine only.
My Idea was to access the test.txt file as a user (MYUSERNAME) with my
password. I can access the file via file browser but if I do it in ASP.NET
Web application I get an access denied error.
The code is:
WebClient webClient = new WebClient();
string username = "MYMACHINENAME\\MYUSERNAME";
string password = "MYPASSWORD";
string domain = "MYDOMAIN";
webClient.Credentials = new
System.Net.NetworkCredential(username,password,domain);
binFile = webClient.DownloadData("\\\\FRIENDSCOMPUTER\\Test\\test.txt");
if (binFile.Length == 0) return null;
MemoryStream memStream = new MemoryStream(binFile);
I would be really thankful if you could point me to a solution.
Thanks a lot
p.
I am breaking my head on one problem. I'd like to read a file that is on a
different machine in intranet. The tricky part is that I do not want to
allow an access for EVERYONE but want to minimise it for my machine only.
My Idea was to access the test.txt file as a user (MYUSERNAME) with my
password. I can access the file via file browser but if I do it in ASP.NET
Web application I get an access denied error.
The code is:
WebClient webClient = new WebClient();
string username = "MYMACHINENAME\\MYUSERNAME";
string password = "MYPASSWORD";
string domain = "MYDOMAIN";
webClient.Credentials = new
System.Net.NetworkCredential(username,password,domain);
binFile = webClient.DownloadData("\\\\FRIENDSCOMPUTER\\Test\\test.txt");
if (binFile.Length == 0) return null;
MemoryStream memStream = new MemoryStream(binFile);
I would be really thankful if you could point me to a solution.
Thanks a lot
p.