How to make ASP.NET Routing escape route values?

后端 未结 4 2049
别跟我提以往
别跟我提以往 2020-12-11 19:16

I have an ASP.NET MVC site where I want routes like /{controller}/{id}/{action}/{date}, where \"date\" is the mm/dd/yyyy portion of a date/time. (I\'m

4条回答
  •  自闭症患者
    2020-12-11 19:53

    I don't know if this counts as an answer or not, but I always use yyyy-mm-dd format in URIs. Not because slashes are reserved per the RFC (although that's a good reason) but because it is immune to globalization issues when converting to/from a string. DateTime.Parse() "just works" with this format, even if someone sets the server locale to somewhere in Eastern Europe.

提交回复
热议问题