I'm not sure the subject explains well enough what I'm trying to do.
I'm building a smart redirect system to catch 404 errors on a web site then redirect them to a resource based on values a user enters to help decide where to forward the 404 resource.
For example, MyProduct.htm comes in, but I have a new web site and I want this to forward to Products.aspx
Another example: Detail.aspx?ID=3 comes in (pointing to a product in an old store) and I want it to redirect to ProductInfo.aspx?productid=38
So, I can capture all the 404 pages that are coming in, but I have to take this page value Y and figure out which row that the user entered matches this.
What makes this tricky is I'd like to allow users to enter wildcards. Such as *.htm points to Default.aspx. Or *Neal*.php points to Neal.aspx or Detail.aspx?ID=2-25 to point to SomeURL (notice it could be a parameter value from 2 to 25).
So, the configuration table a user configures the redirects would look like:
*.htm -----> Default.aspx
*Neal*.php ---> Neal.aspx
Detail.aspx?ID=2-25 ---> http.....
So the problem is, I catch a 404 and determine it's SomePage.php. How would I go through the table and determine WHICH row matches this item so I can determine the target? Or in another case, Detail.aspx?ID=12 comes in, how would I determine this fits a row in the configuration table to find the result?
So in other words, it's reverse of what we normally do with a database. Typically we would use SQL to do a LIKE search using Wildcards. Instead, I have the value, and I have to determine which Wildcard value would find this result, i.e. reverse engineering the search.
Again, using a simple two column dataset. If necessary, I could dump it to a Hashtable...
Any suggestions?
I'm building a smart redirect system to catch 404 errors on a web site then redirect them to a resource based on values a user enters to help decide where to forward the 404 resource.
For example, MyProduct.htm comes in, but I have a new web site and I want this to forward to Products.aspx
Another example: Detail.aspx?ID=3 comes in (pointing to a product in an old store) and I want it to redirect to ProductInfo.aspx?productid=38
So, I can capture all the 404 pages that are coming in, but I have to take this page value Y and figure out which row that the user entered matches this.
What makes this tricky is I'd like to allow users to enter wildcards. Such as *.htm points to Default.aspx. Or *Neal*.php points to Neal.aspx or Detail.aspx?ID=2-25 to point to SomeURL (notice it could be a parameter value from 2 to 25).
So, the configuration table a user configures the redirects would look like:
*.htm -----> Default.aspx
*Neal*.php ---> Neal.aspx
Detail.aspx?ID=2-25 ---> http.....
So the problem is, I catch a 404 and determine it's SomePage.php. How would I go through the table and determine WHICH row matches this item so I can determine the target? Or in another case, Detail.aspx?ID=12 comes in, how would I determine this fits a row in the configuration table to find the result?
So in other words, it's reverse of what we normally do with a database. Typically we would use SQL to do a LIKE search using Wildcards. Instead, I have the value, and I have to determine which Wildcard value would find this result, i.e. reverse engineering the search.
Again, using a simple two column dataset. If necessary, I could dump it to a Hashtable...
Any suggestions?