繁体   English   中英

Xml 文件结果在不同浏览器上显示不一样

[英]Xml file result doesn't appear the same on different browsers

我将 asp.net 与 C# 一起使用,并且我为 rss 页面制作了此代码:

<%@ Page Language="C#" ContentType="text/xml" AutoEventWireup="true" CodeFile="rss.aspx.cs" Inherits="rss" %>    
<asp:repeater id="RSSrepeater" runat="server">
<HeaderTemplate>  
<rss version="2.0">  
<channel>  
<title>MaGaZiNo</title>  
<link>http://localhost/Default.aspx</link>  
<description>  
MaGaZiNoOoOoOoOo
</description>  
</HeaderTemplate>  
<ItemTemplate>  
<item>
<title><%# RemoveIllegalCharacters(DataBinder.Eval(Container.DataItem, "title")) %></title>
<link>http://localhost/articles.aspx?art_id=<%# DataBinder.Eval(Container.DataItem, "articleid") %></link>  
</item>  
</ItemTemplate>  
<FooterTemplate>  
</channel>  
</rss>    
</FooterTemplate>  
</asp:repeater>

它在 IE 上运行良好,但它在 chrome 上给了我这个消息:

此 XML 文件似乎没有任何与之关联的样式信息。 文档树如下所示。

结果看起来像 xml 标签,我发现了一些类似的问题,但都不是 asp 或建议使用 css 或 xsl,是否有其他解决方案而不是使用样式表? 喜欢为特定浏览器使用一些插件吗?

这可能是错误的,因为我不熟悉 ASP 但您已将 MIME 类型设置为text/xml 我想这就是 Chrome 将其显示为 XML 的原因。

对于 RSS 提要,它应该是application/rss+xml

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM