ASP.NET无法找到HttpUtility [英] ASP.NET can not find HttpUtility

查看:151
本文介绍了ASP.NET无法找到HttpUtility的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

名称'HttpUtility'不在当前上下文中存在

The name 'HttpUtility' does not exist in the current context.

我有点困在这里。我有我的文件的顶部,有没有错误,而的System.Web 列出使用的System.Web 在我引用。我试着双击参考,找到 UrlEn code 方法在对象浏览器,并从字面上拖丢弃方法进入我的code,它仍然无法找到 HttpUtility 。我缺少什么?

I'm a bit stuck here. I have using System.Web at the top of my file, which has no error, and System.Web is listed in my references. I tried double-clicking the reference, finding the UrlEncode method in the object browser, and literally drag-and-dropping the method into my code, and it still can't find HttpUtility. What am I missing?

下面是code,归结:

Here is the code, boiled down:

using System.Web


string path = "path/to/file";
path = HttpUtility.UrlEncode(path);

排位赛完全不HttpUtility也不帮忙。它甚至没有在自动完成列表中显示出来。只有性AspNetHostingPermission出现了。

Fully qualifying HttpUtility doesn't help either. It doesn't even show up in the auto-complete list. Only "AspNetHostingPermission" shows up.

推荐答案

看我像你有你的解决方案的另一个库,这就是你在哪里试图访问HttpUtility。如果这是正确的,你需要在你的库添加到System.Web程序DLL的引用。

Look to me like you have another library in your solutions and that's where you are trying to access the HttpUtility. If that's correct, you need to add a reference to System.Web dll in your library.

让我知道,如果是这样的话。

Let me know if that was the case.

这篇关于ASP.NET无法找到HttpUtility的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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