URL Routing C# mvc and Web Forms

前端 未结 2 1264
心在旅途
心在旅途 2021-01-27 09:42

So I have a webforms and an mvc application combined and am trying to get things routed correctly. I have the default routing working as expected, but when I click on an actionl

2条回答
  •  孤城傲影
    2021-01-27 10:21

    I think it might be because the first route that matches is the Default.aspx route so it uses that, with the URL "". In MVC any parameters provided but not included in the path are automatically added as querystring values.

    Routes are picked up in the order they are defined so try moving routes.MapPageRoute("", "", "~/Default.aspx", true); to be after the Default route. You might need to remove the controller default if you do this otherwise this route will get picked up for the URL "" which will pass to the Index action on the Chips controller.

提交回复
热议问题