Tutorial :Url rewriting in asp.net web forms (with some complications)



Question:

When it comes to URL Rewriting there are some alternatives these days like the IIS7 module or Urlrewriter.NET. However, as far as I can see those two are based on wildcards which I sadly cannot use.

My problem is that the data I'm working with have no real structure. A made up example:

Something.aspx?page=4 might be /Weapons/Flails/ Something.aspx=page=5 might be /Clothes/Dresses/Blue/

i.e. there is no clear match between page id and what kind of page it is pointing to. I guess this requires some kind of lookup (slugs?) in a db.

How would I implement this in the easiest way? Does any of the existing alternatives offer a solution to this or do I have to build my own module?

Thank you.


Solution:1

IIS7 had a regular Expression option not just wild card it also has Rewrite maps. which i think is what you are looking for, it could be your look up table.

when you set up a rewrite rule, use the drop down to find the regEx option. also when you create the rule, the option for the map is there.


Solution:2

You can also use the Managed Fusion URL Rewriter and Reverse Proxy. It support the Apache mod_rewrite sytnax of configuring rewriting. And you can use this method described on my blog to create a module that can do a database lookup of these old ID's and redirect them to the correct location.

http://www.coderjournal.com/2008/12/creating-extension-module-net-url-rewriter-reverse-proxy/

Please contact me through my blog if you would like help setting up this type of rewriting.


Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »