简体   繁体   English

.Net 2.0 HttpUtility.UrlEncode问题

[英].Net 2.0 HttpUtility.UrlEncode issue

I am working with a project in .Net 2.0, this must stay in .Net 2.0 I have no way around this as this is what the customer wants. 我正在使用.Net 2.0中的一个项目,该项目必须保留在.Net 2.0中,我无法解决这个问题,因为这是客户想要的。

I am trying to create a string that is going to url encode this 我正在尝试创建一个将进行URL编码的字符串

HttpUtility.UrlEncode(key);

However, I get the message 但是,我得到消息

HttpUtility does not contain a definition for UrlEncode HttpUtility不包含UrlEncode的定义

Looking at MSDN here https://msdn.microsoft.com/en-us/library/system.web.httputility.urlencode(v=vs.80).aspx I see that this should be easily possible. 在此处查看MSDN https://msdn.microsoft.com/zh-cn/library/system.web.httputility.urlencode(v=vs.80).aspx,我认为这应该很容易实现。

I have my using statement bringing in System.Web and it is in my references too. 我将我的using语句引入System.Web,它也在我的引用中。

Any ideas on what I need to do? 关于我需要做什么的任何想法?

If you are having trouble with system.web use the alternate method as shown in this blog. 如果您在使用system.web时遇到问题,请使用此博客中显示的替代方法。 Html-and-Uri-String-Encoding-without-SystemWeb 不带SystemWeb的HTML和Uri字符串编码

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

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