0

I'm trying to route a path like this:

http://www.wikipediamaze.com/wiki/Washington,_D.C.

The routing framework is not picking this up as a valid route and giving me a "Cannot find resource" error. Anyone know how I can get around this? It's not even getting to my controller factory so it's as if it doesn't even recognize it as a route or perhaps looking for an actual file.

I don't have any problems with similar routes like this:

http://www.wikipediamaze.com/wiki/United_States
http://www.wikipediamaze.com/wiki/Canadian_Bacon_(film)

but anytime I end a url with a '.' it doesn't route it. If I do this it works:

http://www.wikipediamaze.com/wiki/?topic=Washington,_D.C.

The route that I have setup looks like this:

routes.MapRoute(
    "wiki",
    "wiki/{topic}",
    new { controller = "game", action = "continue", topic = "" }
);
Micah
  • 111,873
  • 86
  • 233
  • 325

1 Answers1

0

The dot is being interpreted as the beginning of a file extension as in

mypage.mvc or index.aspx

I wouldn't know the first clue about how to fix it, although the form

http://www.wikipediamaze.com/wiki/?topic=Washington,_D.C.

looks very clear and concise to me. This form works because MVC automatically knows that a question mark is going to be followed by a named parameter, and not another partial route.

Robert Harvey
  • 178,213
  • 47
  • 333
  • 501
  • The issue is that I'm screen scraping the wikipedia site and using the links as is on the page: Washington D.C I don't want to have to rewrite all the links to the form /wiki/?topic=Washington,_D.C. – Micah Jun 03 '09 at 02:01
  • Can you strip off the last period if it exists? – Robert Harvey Jun 03 '09 at 02:13
  • The problem is that when my contreller action gets called the topic is passed in which I then use to screen-scrape wikipedia. so it matches www.wikipedia.org/wiki/Washington,_D.C. – Micah Jun 03 '09 at 02:35