Solved

How to create an RFC822 pubdate using asp.net 1.1

Posted on 2010-09-16
9
875 Views
Last Modified: 2013-11-18
We use a content management system which is based on asp.net framework 1.1. A developer created a page for us which generates an RSS feed from information in a database. It has worked fine, for the most part, with RSS appearing with the correct publication date in Firefox and Google Reader.

We are now trying to get the feed to appear correctly in the Windows 7 Desktop Gadget (using Feeds in IE8) - however some items don't appear at all and others appear with the wrong publication date (defaulting to Sat 30 Dec 00:00:00)

The code below is used to create the pubDate - is doesn't validate when the feed is checked, but as mentioned, most readers seem to handle it fine. What do I need to do to format the time correctly for the validator and IE?
xtwFeed.WriteElementString("pubDate", formatDateTime(dtrStatus("IncidentDateTime"),2).toString() & " " & formatDateTime(dtrStatus("IncidentDateTime"),4).toString())

Open in new window

0
Comment
Question by:LSE_IT_Training
9 Comments
 
LVL 25

Expert Comment

by:Luis Pérez
ID: 33691119
0
 

Author Comment

by:LSE_IT_Training
ID: 33692958
I can't seem to use that example to convert the text above into the correct date format. I think the problem lies with the fact I am not using Now to get the date, but dtrStatus("IncidentDateTime"). When I try and replace Now with dtrStatus("IncidentDateTime"), I get this error:

 'dtrStatus' is not a member of 'Date'.


0
 
LVL 25

Expert Comment

by:Luis Pérez
ID: 33694460
Don't use Datetime.dtrStatus, but only dtrStatus.
0
What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

 

Author Comment

by:LSE_IT_Training
ID: 33777233
I get the following error when I change:
xtwFeed.WriteElementString("pubDate", dateTime.dtrStatus("IncidentDateTime").toString("r") )
to:
xtwFeed.WriteElementString("pubDate", dtrStatus("IncidentDateTime").toString("r") )

BC32016: 'Public Overridable Function ToString() As String' has no parameters and its return type cannot be indexed.
0
 
LVL 55

Assisted Solution

by:Jaime Olivares
Jaime Olivares earned 150 total points
ID: 33904046
LSE,
I think the problem is that your data is not in DateTime format, so you cannot use ToString("r")
I don't know exactly how you data is formatted, but you can divide your problem in parts:

Dim d as DateTime = CType(dtrStatus("IncidentDateTime"), DateTime)

xtwFeed.WriteElementString("pubDate", d.toString("r") )

0
 
LVL 17

Accepted Solution

by:
ToAoM earned 350 total points
ID: 33906113
You'll need to cast the object, coming from the Datarow(?), to dateTime in order to use the ToString method that accepts a format.

C#:
xtwFeed.WriteElementString("pubDate", ((DateTime)dtrStatus("IncidentDateTime")).ToString("r") )

VB.NET:
xtwFeed.WriteElementString("pubDate", CType(dtrStatus("IncidentDateTime"), DateTime).ToString("r") )
0
 

Author Closing Comment

by:LSE_IT_Training
ID: 33927516
Thanks to Jaime for the explanation of why there was a problem and to ToAoM to the exact code I needed to fix it easily.

Much appreciated.
0

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

This article covers the basics of the Sass, which is a CSS extension language. You will learn about variables, mixins, and nesting.
Shoutout to Emily Plummer (http://www.experts-exchange.com/members/eplummer26.html) for giving me this article! She did most of it, I just finished it up and posted it for her :)    Introduction In a previous article (http://www.experts-exchang…
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now