本文介绍了我在 Visual Studio 2010 上遇到错误:类型或命名空间名称“HttpUtility"不存在的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我该如何解决?如果我在我的代码中做:使用 System.Web;它有帮助我尝试添加 System.Web.ApplicationServices 的引用没有帮助也尝试引用:System.WebServices 也没有帮助.这是 Visual Studio 2010 .net 引用列表中仅有的两个使用 Web 的引用.

How can i solve it ?If im doing in my code: using System.Web; it dosent helpI tried ot add reference of System.Web.ApplicationServices didnt help also tried to reference: System.WebServices Didnt help either. This is the only two references that are using Web i have in the visual studio 2010 .net references list.

该行是:

var queryString = System.Web.HttpUtility.ParseQueryString(url);

错误在:HttpUtility

The error is on the: HttpUtility

错误 1 ​​命名空间System.Web"中不存在类型或命名空间名称HttpUtility"(您是否缺少程序集引用?)

Error 1 The type or namespace name 'HttpUtility' does not exist in the namespace 'System.Web' (are you missing an assembly reference?)

该项目在 Target Framework 上设置为:.net 4 客户端配置文件.我有 Windows 8 64 位.

The project is set on Target Framework to: .net 4 client profile. I have windows 8 64bit.

推荐答案

这就是问题所在.HttpUtility 没有存在于客户档案中.改为定位完整配置文件(并确保您有对 System.Web.dll 的引用).

That's the problem. HttpUtility doesn't exist in the client profile. Target the full profile instead (and make sure you have a reference to System.Web.dll).

比较上述文档中的版本信息"行:

Compare the "Version information" line from the above documentation:

.NET 框架
支持:4.5、4、3.5、3.0、2.0、1.1、1.0

与(比如说)System.String:

.NET 框架
支持:4.5、4、3.5、3.0、2.0、1.1、1.0
.NET Framework 客户端配置文件
支持:4、3.5 SP1
可移植类库
受支持:可移植类库
.NET 用于 Windows 应用商店应用
支持:Windows 8

这篇关于我在 Visual Studio 2010 上遇到错误:类型或命名空间名称“HttpUtility"不存在的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

11-03 11:16