R – ASP.NET/URL Rewriting in a development environment

asp.neturl-rewriting

This is a general question about dealing with URL Rewriting in a development environment. I'm developing a CMS to learn ASP.NET/C#, and I will of course need to implement URL Rewriting. This technique is known to me since I've been using with PHP for several years. However in PHP, you can have a local HTTP server, modify the PHP content directly, refresh the page and see the results. Of course in ASP.NET it's not exactly the same, since you need to compile and then publish the code.

The problem I have is that I need to check the URL Rewriting-friendly links my code will generate in my development environment – basically, make the ASP.NET Development Server compatible with URL Rewrite. Or maybe not.

My question really is: what is the best solution to do that? Use IIS/Apache2 (w/ Mono) for the development server?

Best Answer

If you're developing I'll make a guess that you're doing it on Windows. The amount of hosts out there for Mono and Linux/Apache is fairly slim so it's best to get use to the IIS way of doing things.

For IIS Vista/Windows 7 you have a number of choices

  • One URL rewrite of many HTTP module for ASP.NET - this works very well if you only want rewritting on your ASP.NET pages. You can also infact map other filetypes since the IIS 7 changes
  • A URL rewriter ISAPI extension for IIS - faster than using the ASP.NET and more familiar to you if you're use to mod_rewrite.
  • Play about with ASP.NET MVC to get some instant results.

Scott Guthrie has a big post on it, and this question will help a lot.