0

I want to save a file from a http link to the local drive just temporarily in order to access it, this one is working so far and I'm getting the data but a need to write this data to a local file, for example to C:\Windows\temp\test.text, this file should be deleted afterwards.

WebClient client = new WebClient();
string url = "http://www.example.com/test.text";
var file = client.DownloadData(url);

could any one help me on this, thank you!

ntsu
  • 67
  • 1
  • 7

1 Answers1

0

You cannot write a file on client machine due to security, Any program executing in the browser executes within the browser sandbox and has access to limited features like printer, cookies, etc.

You can write the data to file as a Response object to the client's browser. The Client has the choice of whether to save it or not to his machine.

Vivek Nuna
  • 25,472
  • 25
  • 109
  • 197