Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7973711
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T08:10:58+00:00 2026-06-04T08:10:58+00:00

OK for the record, I’m MUCH more familiar with Java and RnR than any

  • 0

OK for the record, I’m MUCH more familiar with Java and RnR than any .NET. I have fixed a few bugs in a function here and there and Googled a few new “features” here and there but it’s not my expertise. OK cavets out of the way, here’s my issue, I need to create a RSS feed for our site built in ASP.NET. Google turned up a few solutions, but I used this one as an example:
http://www.aspfree.com/c/a/C-Sharp/Creating-an-RSS-Feed-with-ASP-Net-Written-in-C-Sharp/

Oddly, I get it all to work with no errors that I can see but I only get a blank page when I run it. I’ve tested the SQL, it works and returns the rows I want but I don’t know how to diagnose if it’s connecting to the DB or not or why it’s not returning anything. Here’s the code:

asp.aspx.cs:

using System;
using System.Text;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Data.SqlClient;
using System.Drawing;
using System.Xml;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using System.Diagnostics;


       //Class for returning RSS feed Data

   public partial class rss : System.Web.UI.Page
{

    private void Page_Load(object sender, System.EventArgs e)
    {
        string sSource;
        string sLog;
        string sEvent;
        sSource = "RSS Feed";
        sLog = "Application";
        sEvent = "Database Connectiont";
       // Connect to the Database
       SqlConnection myConnection = new SqlConnection("Data Source=localhost;Initial Catalog=events;Persist Security Info=True;User ID=wa;Password=password;");
       // Retrieve the SQL query results and bind it to the Repeater
       const string SQL_QUERY = "SELECT EventName, Comments, URL, StartDate FROM event WHERE SaleDateTo > getdate() AND SaleDateFrom < getdate() AND redirecttourl is not null ORDER BY EventDate";
       SqlCommand myCommand = new SqlCommand(SQL_QUERY, myConnection);
       bool IsDbAvailable = true;
       try {
           myConnection.Open();
           rptRSS.DataSource = myCommand.ExecuteReader(CommandBehavior.CloseConnection);
           rptRSS.DataBind();
           myConnection.Close();
           }
           catch {
                IsDbAvailable = false;
                if (!EventLog.SourceExists(sSource))
                        EventLog.CreateEventSource(sSource,sLog);
            }
        finally {
            myConnection.Close();
        }     
    }

    protected string FormatForXML(object input)
    {
       string data = input.ToString(); //cast input to string

       // replace those characters disallowed in XML documents
       data = data.Replace("&", "&amp;");
       data = data.Replace("\"", "&quot;");
       data = data.Replace("'", "&apos;");
       data = data.Replace("<", "&lt;");
       data = data.Replace(">", "&gt;");

       return data;
    }
}

rss.aspx:

    <%@ Page language="c#" CodeFile="rss.aspx.cs" ContentType="text/xml" AutoEventWireup="false" Inherits="rss"%>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >

<asp:Repeater id="rptRSS" runat="server">

  <HeaderTemplate>
    <rss version="2.0">
      <channel>
        <title>TA On-Sale Feed</title>
        <link>http://www.website.com/rss.aspx</link>
        <description>All events current on-sale</description>
  </HeaderTemplate>

    <itemTemplate>
    <event>
    <title><%#FormatForXML(DataBinder.Eval(Container.DataItem,"EventName"))%>
    </title>
    <description>
    <%#FormatForXML(DataBinder.Eval(Container.DataItem, "Comments"))%>
    </description>
    <link>http://order.ticketalternative.com<%#DataBinder.Eval(Container.DataItem, "url")%>
    </link>
    <eventdate>
    <%#DataBinder.Eval(Container.DataItem, "StartDate")%>
    <eventdate>
    </event>
    </ItemTemplate>
     <FooterTemplate>
          </channel>
        </rss>
      </FooterTemplate>
    </asp:Repeater>
</html>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T08:11:00+00:00Added an answer on June 4, 2026 at 8:11 am

    Fill your result set into a DataTable/Dataset using SQLDataAdpter and then assign the Dataset/Table to rtpRSS.DataSource.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to record what various sources have to say about a historical figure.
I have a record set with hundreds of rows. when a user clicks the
is it possible to record a video straight to Youtube? Say I have a
Error: ..\Record.cpp: In function `std::ostream& operator<<(std::ostream&, Record&)': ..\Record.cpp:83: error: no match for 'operator<<' in
I have an inventory record XML file to store the quantity of each item.
I have a json record like blow [{low:null,high:10,type:2,value:0},{low:10,high:60,type:1,value:10},{low:60,high:null,type:2,value:11}] I would like to create array
If I record an audio file and I have a core data object representing
Using CodeIgniter's Active Record class and MySQL, I have a table of posts with
I currently have one record (with various values) and three user constants with specific
So have gotten to record in my F# journey and at first they seem

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.