Answer the question
In order to leave comments, you need to log in
ASP.NET MVC Framework special character encoding?
Good evening Habr!
I recently started learning ASP.NET MVC Framework and came across the following issue. Let's say I want to make a controller for searching the site like /search/<word>. But after all, the user can enter anything into the search, including / and * and other special characters, but .NET, according to my feelings, first translates the characters from “percent encoding” to “normal form” and only then determines which controller to transfer.
Suppose the user entered “movies / games” into the search, the site will receive a request like /search/%E8%E3%F0%FB%2F%F4%E8%EB%FC%EC%FB and this same %2F will be translated first to "/", and the whole request to /search/movies/games and only then the controller will be determined. Accordingly, in my route defined as /search/{query}/{page}, where page restrictions are imposed either absent or consists of numbers, such a request will not fall and the site will return a 404 error.
How to properly escape special characters?
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question