I must admit I cheated a bit by moving this code into a Visual Studio Project with a code behind file. This may lead you to believe that this code does only work with Visual Studio, but I ensure you that's not the case.
The one thing that I changed, apart from moving the @Import to Imports statements in my code behind file, was drop the Main method and instead dump your code in the Page_Load of my page.
That is also probably causing this code not to run on your machine. In the ASP.NET world, Main is not a magical name for a method. Instead of Main you could have used Imar() or KWilliams() or whatever. So, basically, the framework treats this as a normal method and waits for code that triggers it.
To run the code when the page loads, you need to add it to the Page_Load method. In Visual Studio .NET you can declare that method like this:
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
' Code here
End Sub
However, in the Web Matrix, I think the AutoEventWireUp or whatever it is called is on by default, so you may get away with just Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs)
So, move your code to a method that is called at run-time and see if that makes a difference....
Cheers,
Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
While typing this post, I was listening to:
06 - Monsters In The Parasol by
Queens of the Stone Age (Track 6 from the album:
Rated R)
What's This?