简体   繁体   中英

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

I'm using asp.net with C# ,and I've made this code for an rss page:

<%@ 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>

it works fine on IE ,but it gives me this message on chrome:

This XML file does not appear to have any style information associated with it. The document tree is shown below.

and the result looks like xml tags , I've found some similar questions ,but all are either not asp or suggested using css or xsl, is there any other solution rather than using stylesheets ? like using some pulgins for specific browsers or something ?

This might be wrong since I'm not familiar with ASP but you have set the MIME type to text/xml . I would imagine this is why Chrome displays it as XML.

For an RSS feed it should be application/rss+xml .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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