Can't sent xml file from Web Application on Internet Explorer
Posted
by nCdy
on Stack Overflow
See other posts from Stack Overflow
or by nCdy
Published on 2010-05-27T09:44:59Z
Indexed on
2010/05/27
9:51 UTC
Read the original article
Hit count: 248
Error is something like that :
Can't load Items.aspx from 192.168.0.172
And a text is Can't open this web-site. It can't be found. Try later
code :
HttpContext.Current.Response.Clear();
HttpContext.Current.Response.Cache.SetCacheability(HttpCacheability.NoCache);
HttpContext.Current.Response.Charset = System.Text.Encoding.Unicode.EncodingName;
HttpContext.Current.Response.ContentEncoding = System.Text.Encoding.Unicode;
HttpContext.Current.Response.BinaryWrite(System.Text.Encoding.Unicode.GetPreamble());
HttpContext.Current.Response.ContentType = "application/vnd.ms-excel";
HttpContext.Current.Response.AddHeader(
"content-disposition", string.Format(
"attachment; filename={0}",fileName));
....
table.RenderControl(htw);
HttpContext.Current.Response.Write(sw.ToString());
HttpContext.Current.Response.End();
Trouble with this file is only for Internet Explorer (works on opera / firefox ... )
And so it works for HTML with no
HttpContext.Current.Response.ContentType = "application/vnd.ms-excel";
this string
© Stack Overflow or respective owner