Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Security > how to get to file in intranet using WebClient. simple ?!

Thread Tools

how to get to file in intranet using WebClient. simple ?!

Vasko Peter
Posts: n/a
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,dom ain);
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


Reply With Quote

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: How include a large array? Edward A. Falk C Programming 1 04-04-2013 08:07 PM
How to create a simple url to access an intranet JB ASP .Net 0 09-01-2010 02:04 AM
Can't get Intranet ASP Web App to communicate with ASP Web Service? Leo Violette ASP .Net 2 04-21-2009 07:01 AM
in intranet, How can I get the userID using ASP? Kam ASP General 4 09-04-2006 12:27 PM
Simple Intranet Form HTML 0 02-23-2006 05:31 PM