halvorn

halvorn

  • NA
  • 33
  • 0

client should be able to store information to file, trough save as dialog box

Mar 21 2009 6:01 PM
hello,

I have a web application where the user should be able to store some information locally if he likes, for instance in a txt file. The info is supposed to be catched from a string value, so it not about reading from an existing file stored on the server. The user should be allowed to chose target location on his computer.

If I have string variable1 in my c# code which contains some text.

How do i fit this into something like this so the user can save the info without it being stored on server?

            Response.Clear();
            Response.AddHeader("Content-Disposition", "attachment; filename=" + _file.Name); 
            Response.AddHeader("Content-Length", _file.Length.ToString());
            Response.ContentType = "application/octet-stream";
            Response.WriteFile(_file.FullName);
            Response.End();

Answers (1)