开发者

Streamed html from SQL doesn't display images in IE9

I have an html file stored in my SQL database as binary. The html contains image directories, and the images are stored in those directories on the server.

Chrome, Safari, Firefox, IE7, and IE8 all display the images and html text, but IE9 just displays the html text and the words 'bitmap' in place of the images.

This code outputs the html:

Response.Clear();
Response.CacheControl = "no-cache";
Response.Cache.SetCacheabil开发者_JAVA百科ity(HttpCacheability.NoCache);
Response.Cache.SetValidUntilExpires(false);
Response.ExpiresAbsolute = DateTime.Parse("1/1/2000");
Response.Expires = 0;
b = Compression.DeCompressByteArray(b);
Response.OutputStream.Write(b, 0, b.Length);
Response.End();

This is just a snippet showing the main output procedure.

Copying the image directories from the output html and placing it in my address bar opens the images, but IE9 doesn't want to display them inside the html and instead displays the word 'bitmap'

Furthermore:

  • The html(and images) output from SQL, when run as a standalone html works on all browsers.
  • The images do display in IE9 when embed, if I have compatibility mode on (but that breaks other stuff).


How you write the HTML (meaning via C# or whatever, or that it came from SQL Server) is almost certainly irrelevant here. I would suggest viewing the source, confirming that the source HTML (without any interference from ASP.NET, SQL Server, etc.) still exhibits the problem, and post that (and re-tag to reflect that C# and SQL Server have nothing to do with the problem). Also make sure to mention whether it works better when you use compatibility mode.


You'll have to specify the content type for your response. Those headers are missing.

See http://msdn.microsoft.com/en-us/library/ms525208(v=vs.90).aspx

ie, do:

Response.ContentType = "text/HTML"


To answer this question:

The html streamed from my SQL Server doesn't define a doctype and is therefore run in Quirks Mode in IE8 down. IE9 forces an iframe without a doctype to use the doctype of it's parent.

The html is from the output of excel which doesn't produce a doctype when published.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜