nunu
nunu

Reputation: 3252

Asp.Net MVC route action method doesn't call when there is a DOT (.) at the end of url

Configured Route:

routes.MapRoute(
  name: "RedirectToProduct",
  url: "product/page/p{productId}/{shortName}",
  defaults: new { controller = "Product", action = "RedirectToProduct", shortName = UrlParameter.Optional }
);

Action Method:

public class ProductController : Controller
{
    public async Task<ActionResult> RedirectToProduct(string productId, string shortName)
    {
    }
}

Problem..

What I want is- whether I add DOT (.) in the end OR not in productUd parameter, call should go in the controller's action method.

Thanks in advance!

Upvotes: 2

Views: 1132

Answers (1)

L-Four
L-Four

Reputation: 13541

If the dot is the problem, like product/page/p118.5, then add runAllManagedModulesForAllRequests = true to your web.config, like:

<system.webServer>
   <modules runAllManagedModulesForAllRequests="true">
     ...
   </modules>
 </system.webServer>

Upvotes: 2

Related Questions