Saving a file into special folder when File is downloaded on users machine in ASP.Net

Last Reply on Jul 06, 2012 04:30 AM By Mudassar

Posted on Jul 02, 2012 06:05 AM

I need to save a file into special folder.

if (TextBox1.Text == s) 
{ MessageBoxResult mbr = MessageBox.Show(this, "Do you want to save file?", "saved", MessageBoxButton.YesNoCancel); // if (mbr == MessageBoxResult.Yes) // { // //string path = string.Empty; // string path; // path = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\abc\\File"; // if (!Directory.Exists(path)) // Directory.CreateDirectory(path); // }
It creates a folder abc if it doen't exist, i need to save s where s is a textfile.

 

Posted on Jul 06, 2012 04:30 AM

You cannot do what you want. Whenever file is downloaded it cannot be saved on default location. User has right to select where to save it and you or ASP.Net cannot interfere with that