View Full Version : URL Rewriting problem in .NET

16 Jun 2006, 08:01 AM

I am using URL rewriting through a downloaded .NET application. Which uses web.config file for rewriting rules and some other code. The snapshot of web.config is below. I have also checked some other applications which are using the same technique.




<add type="URLRewriter.ModuleRewriter, URLRewriter" name="ModuleRewriter" />


The problem is, that it is dependent on web.config file which only executes when an ASPX request arrives on server. For example, if I rewrite a *.aspx URL in *.html or in any other file format, the web.config file is not activated by the server and hence I get a 404. For example, I cannot use this kind of rewrite rule in my web.config.


Because server gets a request of *.html file and it doesn't hand over it to .NET engine, so finally web.config is not read for this request.

I want to ask for any other way of URL rewriting in asp.net in which I can use any file extension like *.html, *.php, etc in re-writing rules. Like I can do in Apache mod-rewrite.


20 Jun 2006, 11:51 AM
I simply don't use any other extension apart from aspx for all my pages. This way the .net application is always in control.

If you are able to configure your IIS setup you can map other file extensions to the same ASP.net application so that when say a jpeg file is requested the .net application will be invoked.

Another approach is to use an ISAPI filter but I'm unsure of how you would tie this into your .net application.