How do I enable special characters in MVC routing?

前端 未结 2 897
星月不相逢
星月不相逢 2020-12-07 01:42

I\'m using asp.net MVC 4.

These are my routes:

        routes.MapRoute(
         name: \"Default\",
         url: \"{controller}/{action}/{id}\"
             


        
相关标签:
2条回答
  • 2020-12-07 02:02

    In web.config:

    <system.web>
        <httpRuntime requestPathInvalidCharacters="" requestValidationMode="2.0" />
        <pages validateRequest="false" />
    </system.web>
    

    Blatantly stolen from https://stackoverflow.com/a/6026291/299408

    0 讨论(0)
  • 2020-12-07 02:16

    The answer did not work for me. I had to use:

    [ValidateInput(false)]
    public ActionResult Index...
    

    Hope this helps others.

    0 讨论(0)
提交回复
热议问题