System.Web.HttpResponse.WriteFile C# (CSharp) Method

WriteFile() public method

public WriteFile ( string filename ) : void
filename string
return void
		public void WriteFile (string filename)
		{
			WriteFile (filename, false);
		}

Same methods

HttpResponse::WriteFile ( FileStream fs, long offset, long size ) : void
HttpResponse::WriteFile ( IntPtr fileHandle, long offset, long size ) : void
HttpResponse::WriteFile ( string filename, bool readIntoMemory ) : void
HttpResponse::WriteFile ( string filename, long offset, long size ) : void

Usage Example

Example #1
0
        public bool ReturnXls(System.Web.HttpResponse resp, string fileName)
        {
            System.IO.FileInfo f = new System.IO.FileInfo(fileName);
            resp.ClearHeaders();
            resp.ClearContent();

            DialogUtils.SetCookieResponse(resp);

            resp.HeaderEncoding = System.Text.Encoding.Default;
            resp.AddHeader("Content-Disposition", "attachment; filename=" + f.Name);
            resp.AddHeader("Content-Length", f.Length.ToString());
            resp.ContentType = "application/octet-stream";
            resp.Cache.SetCacheability(HttpCacheability.NoCache);

            /*
             * resp.BufferOutput = false;
             * resp.WriteFile(f.FullName);
             * resp.Flush();
             * resp.End();
             */

            resp.BufferOutput = true;
            resp.WriteFile(f.FullName);
            //resp.End();
            return(true);
        }
All Usage Examples Of System.Web.HttpResponse::WriteFile