4

What would be the most appropriate route for this URL?

www.mysite.com/searchkey0

www.mysite.com/searchkey1

Where searchkey is the keyword for a search method? I tried the following route:

routes.MapRoute( _
        "SearchRoute", _
        "search", _
        New With {.controller = "Search", .action = "Search", .id = ""} _
   )

In this route, the URL must have /search/searchkey. I only want to have the searchkey in the URL, and not the word Search.

What am I missing?

1
  • Please mark the answer that helped you as accepted. Commented Sep 21, 2009 at 10:43

2 Answers 2

5

Try this:

routes.MapRoute( _
        "SearchRoute", _
        "{id}", _
        New With {.controller = "Search", .action = "Search", .id = ""} _
   )
Sign up to request clarification or add additional context in comments.

Comments

1

to see what route your mvc is using have alook at this tool

http://haacked.com/archive/2008/03/13/url-routing-debugger.aspx

hth

bones

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.