I'm working on a URL rewriting engine at the moment and would like to
make it more dynamic. I am doing this via Global.asax and as of now I
have to manually write the URL's one-by-one. I am wanting to use a RegEx
on a string and then access the dynamic page this way. For example:
Let's say that the static URL I implement is:
Wonkas_widgets_factory_Tonka_Truck_002.aspx
I would want this to point to:
product.aspx?productID=002
To accomplish this I would simply need to use the RegEx:
\d{3}
Now let's say that I have the following code in Application_BeginReguest
(Global.asax):
Sub Application_BeginRequest(ByVal sender as Object, ByVal e as
EventArgs)
Dim httpContext As System.Web.HttpContext = httpContext.Current
Dim currentURL As String = Request.Path.ToLower()
If currentURL.IndexOf("Willy_Wonkas_widget_factory_00 1") > 0 Then
httpContext.RewritePath("product.aspx?productID=00 1")
End Sub
What would be the best way to implement this RegEx so that I can create
many static URL's?
*** Sent via Developersdex http://www.developersdex.com ***