Attribute Routing with Multiple Leading Zero Decimals

后端 未结 2 1680
北荒
北荒 2021-01-20 22:20

Current ActionResult:

[Route(\"EvaluatorSetup/{evalYear}/{department}\")]
public ActionResult RoutedEvaluatorSetup(int evalYear, string department)
{
    ret         


        
2条回答
  •  误落风尘
    2021-01-20 22:42

    The issue is the . in the URL.

    By default, if a . is present the StaticFileHandler handles the request and looks for a filename matching the path on the file system. To override this behavior, you can assign a handler to a URL you are trying to use. For example, adding the following to your web.config:

    
    
      
    
    
    

    will force any request starting with /EvaluatorSetup/ to use the UrlRoutingHandler (the handler associated with MVC routes).

    ** Solution Supplement **

    I found that this solution worked when I ALSO added the following to the httpRuntime element in web.config:

     
        
    
    

提交回复
热议问题