Showing posts with label file save open dialog box. Show all posts
Showing posts with label file save open dialog box. Show all posts

Wednesday, July 27, 2011

download box instead of direct open file in new window.

#region download-file
static public void DownloadFile(string filePath)
{
try
{
filePath = filePath.Replace(" ", "_");
HttpContext.Current.Response.ContentType = "application/octet-stream";
HttpContext.Current.Response.AddHeader("Content-Disposition", "attachment; filename=" + System.IO.Path.GetFileName(filePath));
HttpContext.Current.Response.Clear();
HttpContext.Current.Response.WriteFile(filePath);
HttpContext.Current.Response.End();
}
catch (Exception ex)
{
throw ex;
}
}
#endregion

.net core

 Sure, here are 50 .NET Core architect interview questions along with answers: 1. **What is .NET Core, and how does it differ from the tradi...