简体   繁体   English

asp.net mvc Url.Content是否对字符串进行编码?

[英]Does asp.net mvc Url.Content encode the string?

asp.net mvc Url.Content是否对输入进行编码,还是应该在其上使用Url.Encode?

No. 没有。

According to http://msdn.microsoft.com/en-us/library/system.web.mvc.urlhelper.content(VS.90).aspx it only expands the ~ character. 根据http://msdn.microsoft.com/en-us/library/system.web.mvc.urlhelper.content(VS.90).aspx ,它只扩展了字符。 If that character does not exist then the path is returned as it was passed in. 如果该字符不存在,则路径将在传入时返回。

You can also test it. 你也可以测试一下。 Using ASP.Net 4.0 it did not for me. 使用ASP.Net 4.0它不适合我。

The Content method just converts a virtual path to an absolute application path. Content方法只是将虚拟路径转换为绝对应用程序路径。 What is there to Encode? Encode有什么用?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM