开发者

ASP.NET MVC A problem with passing an encrypted string to the controller's action

let's way that one of my controller's ac开发者_如何学Pythontion gets - as a parameter - an encrypted string. A problem is, that when the URL looks

MyAccount/Activate/?code=DbXQ2SQiwYYiDhC+ahAppa23P95YifE2z6uyvnhWCFE=

the 'code' parameter in that action looks like:

DbXQ2SQiwYYiDhC ahAppa23P95YifE2z6uyvnhWCFE=

(the "+" char is missing)

why ?


URLs are URL encoded and + is interpreted as a space. Use the Server.UrlEncode() method to encode your encrypted string prior to passing it through the querystring.

Or if this encrypted string is coming from the client side you'll need to use javascript to encode the data. I'm sure there's dozens of articles about the web on how to do this. Here's one example: http://plugins.jquery.com/project/URLEncode


You need to URL encode the code parameter in the GET string. It should be

MyAccount/Activate/?code=DbXQ2SQiwYYiDhC%2bahAppa23P95YifE2z6uyvnhWCFE%3d
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜