Is MVC2 ASP.Net URLDecoding automatically?

余生长醉 提交于 2019-12-06 09:38:00

Yes, MVC automatically url decodes action parameters. But you can still access the url encoded version through query string.

So what I did was to Base64 encode instead of URLEncode my AES encrypted data in my Action Parameter.

As ASP.NET MVC is based on ASP.NET engine (not surprisingly), properly encoded URLs are automatically properly URL decoded by the engine so you don't ever need to ask questions. Simply:

public ActionResult Index(string q)
{
    // TODO : Use the q parameter here as is without ever caring of URL decoding it.
    // It's the caller of this action responsibility to properly URL encode his data
    return View();
}
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!