//data preparation at here...
Page.Response.ClearContent();
Page.Response.ClearHeaders();
Page.Response.Clear();
Page.Response.Buffer = true;
Page.Response.ExpiresAbsolute = DateTime.Now.Subtract(new TimeSpan(1, 0, 0, 0, 0));
Page.Response.Expires = 0;
Response.AddHeader("content-disposition", "attachment;filename=" + YourFileNameHere + ".xls";
//here I use excel file type
Response.ContentType = "application/vnd.ms-excel";
//FileContent is a string variable which stores your file content
Page.Response.AddHeader("content-length", FileContent.Length.ToString());
Response.Write(FileContent);
Response.End();
2010/12/18
Doing some work after Response.End() (11/14/2013 updated)
I need to do something that after users download a file from my website. Most file downloading approach is using something like this:
2010/12/17
Mobile version is on.
Added a mobile version to my blog. If you use your smart phone to browse my blog, it will transfer you to the mobile version of my blog after few seconds.
2010/12/04
Tips: Prevent CheckBox from being changed by user
The easiest way to prevent your CheckBox from being changed by users is adding this to your CheckBox's html code:
OnClick="return false;"For example:
<asp:CheckBox ID="CheckBox1" runat="server" Text="Want a salary increase?" Checked="False" OnClick="return false;" />
Subscribe to:
Comments (Atom)