Saturday, January 31, 2009

Send file to browser

private void SendFile(string fileText, string fileName, string contentType) {
  this.Response.AddHeader("content-disposition", "attachment;filename=" + fileName);
  this.Response.ContentType = contentType;
Typical content types: Text "text/plain" PDF "application/pdf" Got it from: Starting the download with a button inside an UpdatePanel? Register the button for a regular, not partial postback:

Tuesday, January 27, 2009

Page transfer effect that works in Internet Explorer (blendTrans effect)

I can never remember this.
<meta http-equiv="Page-Enter" content="blendTrans(Duration=0.0)">

Monday, January 19, 2009

Quickly check web page performance

Paste this somewhere in your codebehind, putting the dt definitions around the suspected code:
DateTime dt = DateTime.Now;
DateTime dt2 = DateTime.Now; 
DateTime dt3 = DateTime.Now; 
this.debugLiteral.Text = string.Format("<div>|{0}||{1}||{2}|</div>", dt, dt2, dt3);
And paste this somewhere in your aspx:
<asp:Literal ID="debugLiteral" runat="server" />