ASP.NET MVC 4 post action parameters url decode

806 Views Asked by At

I always had the idea that a controller action (asp.net MVC 4), always uses form binder to resolve parameters and decodes them automatically (Url decode and html decode) but this is not working in my case or may be I understand it wrong.

Here is scenario:

  1. jQuery Ajax post to controller/action with parameters
  2. Parameters are escaped using escape function, so that I can pass ' char.
  3. In Action method, I get parameters encoded (javascript escaped) and I have to user HttpUtility.UrlDecode to decode them and then use.
  4. If I use a form and serialize form data and then post, parameters are perfectly decoded automatically.

Does this mean that if I use escape in jQuery ajax parameters, controller action is not going to decode it ? What is the best way?

Thanks

0

There are 0 best solutions below