是MVC2 ASP.Net URLDecoding自动? [英] Is MVC2 ASP.Net URLDecoding automatically?

查看:139
本文介绍了是MVC2 ASP.Net URLDecoding自动?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

于是我打电话像这样的MVC2控制器和I访问经典的查询字符串就好了。请注意,第二个参数是thing2 URLEn codeD已经又一次检索URLEn codeD查询字符串和URLDecoding是没有问题的。我的例子是这样的...

So I was calling the Controller in MVC2 like this and I accessed the classic querystrings just fine. Please notice that the second parameter thing2 is URLEncoded already and again retrieving the URLEncoded querystring and URLDecoding is no problem. My example looks like this...

http://mydomain.com/controller?thing1=1544& thing2 = somethingURLEn codeD

现在我尝试移动到处理参数MVC2 ASP.Net的方式,让自己一个不错的自定义图路线。我测试它看到,它与一个简单的测试...

Now I try to move to the MVC2 ASP.Net way of handling parameters and make myself a nice custom MapRoute. I test it to see that it works with a simple test...

http://mydomain.com/controller/Index/1544/999

我调试我Index方法里面VS2010一步我成功控制器里面!

I debug with VS2010 step inside of my Index method inside of my controller with success!

我再决定采取下一步措施并更改URL上的最后一个参数是一个URLEn codeD值...

I then decide to take the next step and change the last parameter on the URL to be a URLEncoded value...

http://mydomain.com/controller/Index/1544/somethingURLEncodeD

问题我在浏览器中执行此之后看到的是,它看起来很像MVC2 ASP.Net是自动URLDecoding此之前,我得到我Index方法里面的步骤我的控制器内。

Problem I see after executing this in my browser is that it almost looks like MVC2 ASP.Net is automagically URLDecoding this before I get to step inside of my Index method inside of my controller.

怎么办?我以为我能我的控制器内获得第一,其次做我自己的URLDe code。因为原单的数据是加密的AES和它有正斜杠..,有我的参数prematurely URLDecoding不是副作用,我可以计划左右。

What gives? I thought I would be able to get inside of my controller first and the secondly do a URLDecode of my own. Because the orginal data was AES encrypted and had forward slashes in it.., have my parameter prematurely URLDecoding is not a side effect I can plan around.

请帮忙。

推荐答案

是的,自动MVC URL德codeS动作参数。但是,你仍然可以通过查询字符串访问的URL连接codeD版本。

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

这篇关于是MVC2 ASP.Net URLDecoding自动?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆