Downloading a File with a Save As Dialog in ASP.NET

Posted by: Rick Strahls WebLog, on 21 May 2007 | View original

This seems to be a common question that I hear frequently: How do I download a file from a Web site, but instead of displaying it in the browser see it as a file that can be saved (ie. see the Save As dialog)? Normally when you link a file that file will always display inside of the browser because the browser loads it and automatically determines the content type based on the file extension. So when you click on a link like a jpg image the browser knows it's an image and will display that image....

Advertisement
The leading UI suite for ASP.NET - Telerik radControls
Outstanding performance. Full ASP.NET AJAX support. Nearly codeless development.

Similar Posts

  • August 9th ASP.NET Link-Listing more
  • Accessing Embedded Resources through a URL using WebResource.axd more
  • Add-in Comparison: VSFileFinder 2005 vs. SonicFileFinder more
  • Blogging from Tech Ed 2006 - Stefan Shakow on ASP.NET - level 400 more
  • Common Gotcha: Slow VS 2005 Web Site Build Performance Because of Dueling Assembly References more
  • [SQL] Scripting backup and restore all databases on a server (Part 2 - Extra Credit) more
  • Why ASP.NET 2.0 Login control doesn't work with SQL Membership provider? more
  • Blog Reading and Authoring Review more
  • Disabling System Debug Dialog? more
  • Blogging from Tech Ed 2006 - Stefan Shakow on ASP.NET - level 400 more

News Categories

.NET | ADO.NET | Agile | Ajax | Architecture | ASP.NET | BizTalk | C# | Certification | Community Server | dasBlog | DataGrid | DataSet | Debugger | DotNetNuke | Events | GridView | IIS | Indigo | JavaScript | Mobile | Mono | Patterns and Practices | Performance | Podcast | Refactor | Regex | Security | Sharepoint | Silverlight | Smart Client Applications | Software | SQL | VB.NET | Visual Studio | W3 | WCF | WinFx | WPF | WSE | XAML | XLinq | XML | XSD