Wednesday, May 26, 2010

XSL Transform of a Remote XML feed via Javascript - Requires VB.NET

I wanted to use Javascript to display an RSS feed from a remote web server via a client side XSL transform. Javascript has security levels to prevent 'cross browser' scripting attacks, so it won't let you pull in a remote feed. But, I wanted to do it anyway. Call me crazy.

My solution was to get VB.NET to pull in the feed and echo it from my web server, basically acting as a Proxy, and fooling Javascript into thinking the feed is safe.

I created a .ASPX page to pull in the feed, turn it to a string, and output the feed for Javascript to use.

Stupid Firefox wouldn't load an XML transform from a .ASPX page like IE will, so I had I couldn't stream the file dynamically. Instead, I had to write the script to save the stream to a .XML file.

This script needs to write to an .XML file on your server ( called blogger.xml in this example ). You'll need to assign write permission to that file.

<%@Page Language="VB" %>

<%@ Import Namespace="System.IO" %>
<%@ Import Namespace="System.Xml" %>

Third, I created an .xsl stylesheet for the feed and saved it to my server as a .xsl file. The stylesheet I created is for a Blogger Atom Feed:


( comments)

Then I used Javascript to do a XSL transform of the feed: NOTE: I spent a good deal of grief on this until I discovered my script wouldn't work for me in a .js file. I put it in the HEAD of my page and it worked fine.

<head onload="outputFeeds()">

Monday, May 17, 2010

GoDaddy Ruined my Sunday

So, basically, all I wanted to accomplish on Sunday was to connect my Visual Web Developer to a remote SQL Server database hosted by GoDaddy.

This should have been a piece of cake. I should have been able to set up the connection, do a little testing, and be done before breakfast, right? Well, it didn't work out that way. In fact, at 10:30 pm, I was still cussing up a storm. Turns out, GoDaddy doesn't allow remote connections by default.

If you are one of the lucky ones, the GoDaddy Database Manager will ask you if you would like to allow remote connections during the initial setup of the database. Wait an hour for GoDaddy to create the database, and you should be up and running.

I, however, was not one of the lucky ones. GoDaddy's Database Manager never, ever prompted me to allow remote connections. I tried to fight it. I tried to connect with other services, Visual Studio, Expression Web, etc. No avail. I finally decide to try GoDaddy support. Their email tells me I need to delete all my databases from the Database Manager so they can migrate my service to a server that allows remote connections.

I would normally not be angry, not a bit, in fact. I wouldn't care how many hoops I had to jump through so long as I could get this thing working. Problem is, there isn't a single piece of documentation on the web to let me know GoDaddy was blocking remote connections and I would need them to move me to another server. Thanks for ruining my Sunday, GoDaddy!