I am using Attribute Routing in an MVC4 application. I set the route [Route("test-{testParam1}-{testParam2}")] . Here, `{testParam2} 'may consist of the word test. For example, if I enter the URL as shown below,
localhost:33333/test-temp-test-tempparam2
This gives me error 404. Here, in the url, here {testParam2} has two words test tempparam2 , formatted to test-tempparam2 . When the word test is in the last position {testParam2} , it works well. This means that if the URL looks like .../test-temp-tempParam2-test , it works well. But after that give an error. .../test-temp-test-tempParam2 .
Below is the code that might help ...
[Route ("test-{testParam1}-{testParam2}")] public ActionResult Foo (int testParam2) {...}
Now try to execute two urls.
In my case, the second gives an error. In this case, the first parameter is formatted to test-temp from test temp . It works well at first.
How to solve this problem?
source share