This project has moved and is read-only. For the latest updates, please go here.

Generated RSS is not recognized as RSS feed By most browsers !

Topics: Developer Forum, Project Management Forum, User Forum
Jul 4, 2007 at 1:13 PM
Hi folks,
both my implementation and sample website provided with RSS ToolKit doesn't generate RSS (xml) recognized by opera 9 , IE 7 and firefox 2 as a Feed, only xml shows !.
is there something i'm missing, streaming the rss or whatever ?


Thanks,
Q.
Jul 12, 2007 at 2:27 PM
Hello...

I have exactly the same problem.... Did you find any solution?

I a using ASHX handler to publish my RSS....

Thank
Jul 12, 2007 at 4:17 PM
unfortunately no, I'm also using the ASHX handler ,!
Jul 18, 2007 at 6:51 AM
I'm getting the same problem. Looks like all the rss goodness is being omitted in the feed.

Anyone?

Paul.
Jul 21, 2007 at 1:40 AM
I think it's because all the items appear under the <channel> tag. I tried changing this but then it just barfs :(
Jul 31, 2007 at 2:49 AM
Try this...

Rss.Channel = new Your_Channel();
Rss.Version = "2.0";

// rest of code...as in the ASHX Sample..

// Some one should probably update the sample.

It worked for me..atleast for IE7 and FF 2.0.

HTH.
Cbk Menon
Jul 31, 2007 at 9:20 AM
Yeah, I had that and it still didn't show. In the end I fixed it by going into the RssToolkit code and changing one thing to make it an application/xml+rss. The modified dll can be found in my project here http://www.codeplex.com/SpacesFeeds/SourceControl/DirectoryView.aspx?SourcePath=%24%2fSpacesFeeds&changeSetId=1850. That was the only change I made and it works perfectly now.

SL
Jul 31, 2007 at 12:25 PM
Hi Scott,
i downloaded your RssToolKit build and still have no luck, what have you done exactly ?
Q.
Jul 31, 2007 at 2:34 PM
In the RssHttpHandlerBase.cs file, I changed the ContentType on line 105 to look like this:

context.Response.ContentType = "application/rss+xml";

If I remember correctly, before it was just text before.

Just out of interest, what was the version of the rsstoolkit.dll you downloaded from my project? was it 2.0.0.1?
Jul 31, 2007 at 3:45 PM
yes, it was 2.0.0.1 .
wouldn't you modify RssToolkit.Rss.RssDocumentHttpHandler instead ?
Aug 5, 2007 at 11:16 AM
Edited Aug 5, 2007 at 11:19 AM

cbkmenon wrote:
Try this...
Rss.Channel = new Your_Channel();
Rss.Version = "2.0";

Yup, the samples are broken, but the above fix worked for me (Vista, IIS7, FF). At least that fixes the "feed icon" in the title bar.

It doesn't fix the markup with the RssHyperLink tag though. The address-bar icon has: type="application/rss+xml" added to it by this fix. Perhaps the RssHyperLink tag code-generator needs something like that adding too?

The URLs in the examples are wrong also: they have: NavigateUrl="~/filename.ashx" that gives you a 404 with "/~/filename.ashx does not exist. Fix that by referencing the file without the tilde.
Oct 21, 2007 at 4:02 PM

ScottIsAFool wrote:
In the RssHttpHandlerBase.cs file, I changed the ContentType on line 105 to look like this:

context.Response.ContentType = "application/rss+xml";



I also made this and this helped me. Thanks!
Nov 5, 2007 at 5:19 AM
Edited Nov 5, 2007 at 5:20 AM
Hello!

I am a newbie in asp.net
I have the same problem. I use the RssTookit to create the RSS feed.
However, I could not get them show as subscribable feed in the web browser.
I was trying to change the code in RssHttpHandlerBase.cs line 105 to "application/rss+xml" rebuild the them and use, but i had no luck.
It just show as XML format. Any asp.net experts please help!
Thank you in advance for any helps.

Seth
Nov 11, 2007 at 3:56 AM
This appears to be one of the most popular threads for this project. Are the project owners watching this thread? If so, a couple of comments:

  • Setting content type to "application/rss+xml" seems to work to solve the browser recognition issue. I don't see this recorded as a bug, however. Is this to be regarded as something that needs to be fixed and is this the correct fix?
  • Support for custom RSS XML namespaces (GeoRSS, for example) seems to be missing. Irrespective of the namespaces I define in the RSS template, the output gets overwritten with the defaults RSS 2.0 definition. Mistake on my part, issue, or misunderstanding?
  • How about opening up the contributor and/or wiki editor rights to a broader audience? When I see comments saying "it would be nice if the examples were updated to show...", what I'm reading is "it would be nice if I could just update...". This is, after all, how a wiki is supposed to function, right?

The comments are not meant to be abrasive. Being new to the Codeplex community, perhaps I don't understand the rules of engagement as well as I should. I just don't see how one switches from passive to active involvement in this community. Please help me understand.

Thomas Beck
thomas@beckshome.com
Nov 11, 2007 at 4:03 AM
Edited Nov 11, 2007 at 11:23 AM
sithkong wrote:

Hello!

I am a newbie in asp.net
I have the same problem. I use the RssTookit to create the RSS feed.
However, I could not get them show as subscribable feed in the web browser.
I was trying to change the code in RssHttpHandlerBase.cs line 105 to "application/rss+xml" rebuild the them and use, but i had no luck.
It just show as XML format. Any asp.net experts please help!
Thank you in advance for any helps.

Seth


Setting content type and rss version to 2.0 has worked for me on all my feeds.
Have you done both of these? Are you sure the dll from your source rebuild is getting copied to the bin folder of your web application?
Dec 4, 2007 at 2:52 PM
Hi

I had the same problem. The problem on my site was that my site is using utf-8 encoding but the output from RssToolkit is "<?xml version="1.0" encoding="utf-16"?>".... And IE won't display a xml feed if the encoding specified in the xml is not the same as the encoding from the server.

I solved this quick and dirty by simply change "doc.LoadXml(inputXml);" to "doc.LoadXml(inputXml.Replace("encoding=\"utf-16\"","encoding=\"utf-8\""));" in line 104 in RssHttpHandlerBase.cs

It would off course be nice if there is a better way to change the encoding in the xml output.

- Esben
May 5, 2008 at 8:42 AM
Edit boldRssHttpHandlerBase.csbold and change
boldcontext.Response.ContentType = "text/xml";bold
for
boldcontext.Response.ContentType = "application/rss+xml";bold
On line 104 (give 1 or take 1 line).

Regards,
Manuel Alves
Sep 22, 2008 at 4:44 PM
I have got the same problem as esben2000. And I found a better solution.

In the class RssXmlHelper in method  public static string ToRssXml<T>(T rssDocument) (line 104) we get output xml with encoding utf-16, because we using StringWriter. And in .NET strings are Unicoded (UTF-16).  StringWriter have a property Encoding, that have only get-accessor.

To writing string in UTF-8 encoding we doing following:

It is necessary to create additional class in the Toolkit, that can set Encoding:

public class StringWriterWithEncoding : StringWriter
    {
        private Encoding _encoding;

        public StringWriterWithEncoding()
            : base() { }

        public StringWriterWithEncoding(IFormatProvider formatProvider)
            : base(formatProvider) { }

        public StringWriterWithEncoding(StringBuilder sb)
            : base(sb) { }

        public StringWriterWithEncoding(StringBuilder sb, IFormatProvider formatProvider)
            : base(sb, formatProvider) { }


        public StringWriterWithEncoding(Encoding encoding)
            : base()
        {
            _encoding = encoding;
        }

        public StringWriterWithEncoding(IFormatProvider formatProvider, Encoding encoding)
            : base(formatProvider)
        {
            _encoding = encoding;
        }

        public StringWriterWithEncoding(StringBuilder sb, Encoding encoding)
            : base(sb)
        {
            _encoding = encoding;
        }

        public StringWriterWithEncoding(StringBuilder sb, IFormatProvider formatProvider, Encoding encoding)
            : base(sb, formatProvider)
        {
            _encoding = encoding;
        }

        public override Encoding Encoding
        {
            get
            {
                return _encoding ?? base.Encoding;
            }
        }
    }

(I create this class in file RssXmlHelper.cs)

After that we change method  ToRssXml<T>(T rssDocument) in class RssXmlHelper:  (line 104)

we using follow string:
using (StringWriter output = new StringWriterWithEncoding(new StringBuilder(), CultureInfo.InvariantCulture, Encoding.UTF8))
instead of
using (StringWriter output = new StringWriter(new StringBuilder(), CultureInfo.InvariantCulture))



Oct 7, 2008 at 3:40 PM
Or you could simply change doc.Save(context.Response.OutputStream) in RssHttpHandlerBase.ProcessRequest to doc.Save(context.Response.Output).

- Linus

I

Feb 24, 2009 at 11:17 AM
Edited Feb 24, 2009 at 11:20 AM
Hi,

Not sure if this discussion is still active.

Anyway I have changed the RssHttpHandlerBase.cs to something like this:

doc.LoadXml(inputXml.Replace(

"encoding=\"utf-16\"","encoding=\"utf-8\""));
context.Response.ContentType =
"application/rss+xml";

and built the dll.

Now when I run the demo RssHyperLink.aspx I am able to subscribe to the RSS format and not the ATOM. The ATOM format says Feed format not supported. This is is IE7.

Is there a fix where I can subscribe to both the RSS as well as the ATOM feed?


Thanks,

Wasim

 

 

 

 

 

Apr 3, 2009 at 6:44 PM
The xslt file for converting Rss to Atom is not working correctly (RssToolkit.Resources.RssToAtom.xsl)
Try the one from http://www.kbcafe.com/iBLOGthere4iM/rsstoatom.xslt.xml
Sep 1, 2009 at 9:16 PM

I tried lajjne's suggested solution, but that did not solve the problem.  A variation on AntonPalyok's solution worked for me.  Instead of building StringWriterWithEncoding from scratch, I took the StringWriterWithEncoding class found in the library available at http://www.yoda.arachsys.com/csharp/miscutil/.  You still have to modify line 104 of RssXmlHelper.cs.  Worked like a charm. :)

 

Oct 7, 2010 at 3:31 PM

I am having the same problems with the encoding, which is preventing browsers from properly displaying the feed to end-users.

Does anyone have re-compiled DLL(s) that fix the encoding issue?

Oct 7, 2010 at 3:56 PM
crom84 wrote:

I am having the same problems with the encoding, which is preventing browsers from properly displaying the feed to end-users.

Does anyone have re-compiled DLL(s) that fix the encoding issue?

 You can find here (http://www.mediafire.com/?yf2f3mx0n3c86z3) the sources of the tweaked version I'm using and it produces valid RSS.

Best regards,

Z.

Oct 7, 2010 at 3:58 PM

Thanks a million!