Response.Clear(); if (!Directory.Exists(Path.GetDirectoryName(HttpContext.Current.Request.PhysicalApplicationPath.ToString()) + "\\Files )) { Directory.CreateDirectory(Path.GetDirectoryName(HttpContext.Current.Request.PhysicalApplicationPath.ToString()) + "\\Files ); } DirectoryInfo directory = new DirectoryInfo(Path.GetDirectoryName(HttpContext.Current.Request.PhysicalApplicationPath.ToString()) + "\\Files\\" ); string file_name = directory + "filename" + ".txt"; System.IO.FileInfo file = new System.IO.FileInfo(file_name); Response.AddHeader("Content-Disposition", "attachment; filename=" + strfilename ); Response.AddHeader("Content-Length", file.Length.ToString()); Response.ContentType = "application/octet-stream"; Response.WriteFile(file.FullName); Response.End(); Response.Redirect("");
string file_name = directory + "filename" + ".txt";
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)