IIS and asp.net URL validation weirdness and links

In my Migrating to IIS7 post, I highlighted that building REST frameworks that do meaningful things with Urls is hard on microsoft's platforms.

I encourage you to go and read the comments left by Mike Volodarsky on the issue. He's a Program Manager at Microsoft. Having people from the team building IIS7 responding to people like me highlighting issues shows how some teams really engage proactively with their customers. Kudos!

The other team at Microsoft that understand REST a bit (and IMO the most out of all the teams working on this), is the Astoria team. And of course, because they do funky stuff with their URLs, they hit the same issues as me. So here's a link on how to deactivate some of the checks asp.net does. Nasty registry editing...

I really wish asp.net could recognize when an IHttpHandler does not want validation and let it handle the request, its validation and etc.

Ads

Alt.net London Beers #1

[Update: new location, see below]

Here's the latest development. The alt.net London Beers event is being moved!

Skills Matter is organizing a talk by Gojko Adzic on the Castle Framework on the day we originally planned for the drinks. As everybody has shown strong interest in attending both events, Skills Matter has been kind enough to help us organize the drinks in the Crown Pub in front of their office, so you can now attend both events.

Not only that, but they have also opened the possibility for another presentation on an alt.net subject, so if you feel like presenting, drop me a mail!

I have to thank Catriona at Skills Matter for sponsoring the alt.net London Beers event and inviting all the alt.netters to attend the Castle presentation, as well as Gojko for suggesting the merge of the two events.

So here's the recap:

We'll probably move back to the planned Tottenham Court Road location for our second meet, on the 16th of June. Keep your calendars open!

Ads

Using Rasta #2 - Rasta in it's simplest form

Lack of time and sleep pushes me to be very lazy and present only the most trivial example of what Rasta was built for. Hopefully the future editions will become more interesting.

Rasta does many things, but one of the things you can use it for is Url rewriting for webforms. Simply declare the following in your global.asax file:

using (RastaConfiguration.Manual)

{

    UriSpace.HasTheUri("/home").ForThePage("~/pages/default.aspx");

}

And if you want to provide a url that matches a specific language, just expand this a bit:

UriSpace.HasTheUri("/accueil").InLanguage("fr").ForThePage("~/pages/default.aspx");

This will automatically set the language for the current request in the correct language, while still going to the same aspx.

Another fancy thing in Rasta's manual declaration is the using block. All the configuration needs to happen within that block, and is only applied when you exit the block. The fluent api is built using a chain of language elements that form a sentence. Each element you add to a sentence either replace it's predecessor in the list of sentences, or initiate a new sentence, and each fully-formed sentence will get called whenever the Dispose method is called on the object returned by the call to RastaConfiguration.Manual.

How do sentences get added? When you enter the block, the new object returned by the Manual property sets a CallContext that stores that list. When it is disposed, it calls the chain of sentences to configure itself. And finally, it makes most of the routing structures read-only to optimise them (a typical example is building a read-only tree of the Urls you can use for a site in a structure that is more efficient than if it was write-only).

That also means that trying to apply a configuration at runtime to replace the existing configuration will only succeed when the whole of the operation succeeds. This happens by only writing to a new copy of the configuration data, and committing the write if no exception happened. If you got the configuration wrong, the previous configuration will happily stay on to continue serving request.

Ads