Monthly Archives: January 2011

Add UTF-8 Signature(BOM) at the Start of Response File

In ASP.Net, if you write a file to the client using code like this: HttpContext.Current.Response.Clear(); HttpContext.Current.Response.AddHeader( "content-disposition", string.Format( "attachment; filename={0}", fileName ) ); HttpContext.Current.Response.ContentType = "application/ms-excel"; using( StringWriter sw = new StringWriter() ) { using( HtmlTextWriter htw = new HtmlTextWriter( sw ) ) { // Create a form to contain the grid Table table =… Read More »