Monday, September 8, 2008

How to prompt for Download for a known MIME type

Sometimes you may require a link to download some files like jpg, gif, html etc. But these are known mime types and if you just give a 'href' link it opens in the browser itself. To prompt the user for 'Save as' you need to use the following steps,

Response.ContentType = "application/x-unknown";
string fileName = "file.jpg";
string filePath = "d:\\" + fileName;
Response.AddHeader("Content-Disposition","attachment; filename=" + fileName );
FileStream fs = File.OpenRead(filePath);
BinaryReader br = new BinaryReader(fs);
Response.BinaryWrite(br.ReadBytes(Convert.ToInt32(fs.Length)));
Response.End();

This is code in c#. Similar way you can use this in any other scripting language.

Tags: Response.ContentType, Content-Disposition, ASP.NET, C#, Download a file using c# and ASP.NET

Add To Google BookmarksStumble ThisFav This With TechnoratiAdd To Del.icio.usDigg ThisAdd To RedditTwit ThisAdd To FacebookAdd To Yahoo

Tuesday, September 2, 2008

SQL Server Reporting Services Video download

Today i found a very good video tutorial on SQL Server Reporting Services and its really helpful for beginners to start with.

You can download the video here

Right clock on the link and select Save Link Location.

Watch the video and use full advantage of SQL Server Reporting Services. Its a better option comparing to Crystal Reports.

Add To Google BookmarksStumble ThisFav This With TechnoratiAdd To Del.icio.usDigg ThisAdd To RedditTwit ThisAdd To FacebookAdd To Yahoo