Small blog update, with Url Rewriting

By Jerome at February 11, 2007 16:33 Tags:

Since this little website upgrade to add the blog, posts have been indexed by google with an ugly internal uniqueidentifier of mine.

Incidentally, that does not index well in google. Since the url to a post does not explain what the destination is about, I decided to add an url rewriting HttpHandler, to have the url containing the title of each post or category.

The part about writing the url rewriter has been covered over and over, oh and over, so I won't talk about it here.

Actually, I'm using CrystalTech web hosting -- like my brother Matthieu -- which works really fine, and does a fine job providing ASP.NET 2.0 services.

Their service is providing a tweaked Medium trust level to users, so hosted application have be configured that way. By tweaked, I mean that they re-enabled Reflection, Web, ODBC and OLEDB permissions from the Medium trust profile.

Anyway, you have to deal with Partially Trusted Callers. My application uses a class library in a separate assemnly, which needs to have the AllowPartiallyTrustedCallers attribute set, because of the Medium trust. That avoids this :

[SecurityException: That assembly does not allow partially trusted callers.]

So, if you choose CrystalTech web hosting, remember to try your website under the Medium trust profile to avoid suprises, with this :

<system.web>
   <trust level="Medium"/>
</system.web>

Also, on the side of differences between VS2005 web server and IIS 6.0 behavior : The default handler for any url in VS2005 is ASP.NET and in IIS 6.0 it is the file system. Since my urls are now generated, they definitely don't exist on the file system. I just had to add an ".aspx" at the end of my virtual url to get IIS 6.0 handing it to ASP.NET runtime.

Now I have my nice URLs :)

blog comments powered by Disqus

About me

My name is Jerome Laban, I am a Software Architect, C# MVP and .NET enthustiast from Montréal, QC. You will find my blog on this site, where I'm adding my thoughts on current events, or the things I'm working on, such as the Remote Control for Windows Phone.