Route to convert 'folder' to search

11 Views Asked by At

Can I use the Asp.Net routing for this?

Requested URL = http://example.com/12345

Actual action = http://example.com/search.aspx?id=12345

I've not been able to work out how set this up in my Global.asax

1

There are 1 best solutions below

0
On

I found a solution. I created my own System.Web.IHttpModule handler and checked the url in Rewrite_BeginRequest and redirected to my search page with the "folder" as a parameter. I then had to add my UrlRewriteModule using the following in the web.config.

    <configuration>
        <system.webServer>
            <modules runAllManagedModulesForAllRequests="true">
                <add name="URLChecking" type="UrlRewriteModule"/>
            </modules>
        </system.webServer>
    </configuration>