[英]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.