-1

Question 1:

Suppose i have a file in c drive which is present in the Client Machine like c:\File.txt in a string variable.

String str="C:\File.txt";

i need to save the str variable data to my server in one particular location .

Question 2:

If I use File.ReadAllLines Method , like File.ReadAllLines("C:\File.txt"); does this statement access server's C drive or Client Machine C Drive please clarify my doubt

Naveen
  • 21
  • 7
  • have you done a google search..? come on this is actually quite simple also why don't you try the code and see for yourself where it accesses it from .. the question is quite clear if you are reading a file from a mapped drive or a server location it's from that location..if you are reading a file from your local then it's obvious that it's not from the server... also if you wnat to know more about Paths on the server research this by doing a google search `Server.MapPath` – MethodMan Oct 29 '14 at 16:44
  • If it is ASP.net and you are writing server side code, then all IO is on the servers file system, server side code does not execute in the user's browser. – Ben Robinson Oct 29 '14 at 16:46
  • @DJKRAZE if i am reading a file from c:\File.txt location, does c drive indicates a client machine or server machine is my doubt. – Naveen Oct 29 '14 at 16:58
  • I ask again are you reading from your local drive..? if so then it's local if you are reading from a File Download hence `Server.MapPath` in your code..then it's a remote location.. – MethodMan Oct 29 '14 at 18:04

1 Answers1

0

Since, it exists in client machine , and it is webform ( as it is tagged as asp.net , you can not access that file, unless you use a FileUpload and client ( end user) posts that file using fileupload. If it is going to uploaded, then you have access that using Request.Files.

And if it windows app, and client system has shared location, and you have IO for that, then using network path, you can read the file.

Arindam Nayak
  • 7,346
  • 4
  • 32
  • 48