Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

4
  • You need to use www.mysite.com/?token='token-string' to use token string with default route, thus define a route which expects token parameter (url: "{controller}/{action}/{token}") where token is a required parameter. Commented Jun 19, 2017 at 9:25
  • @TetsuyaYamamoto Is that the only way to do this? I did state in my question that it really does have to be in the format of www.mysite.com/string-token Commented Jun 19, 2017 at 9:26
  • In MVC 5 you can use attribute routing with route [Route("~/{token?}")] on your Index action method, which results in www.mysite.com/string-token. Or define Index action method: url: "{token}" (with default route controller = "Home", action = "Index", token = UrlParameter.Optional). Commented Jun 19, 2017 at 9:30
  • @TetsuyaYamamoto thanks, that did it - if you put it into an answer (the other two didn't work) I can accept :) Commented Jun 19, 2017 at 9:40