我用了
using System;
using System.Web;
using System.Text;在编译
HttpUtility.UrlEncode("8/14/2005",Encoding.UTF8);
时出错,
The type or namespace name 'HttpUtility' could not be found 
所以请问,我该怎么办才能用HttpUtility呢?HttpUtility应该再System.Web namespace里呀

解决方案 »

  1.   

    明明HttpUtility class 就在System.Web namespace里,可她就说没有,难道是我Visio Studio.net 2003的版本需要升级吗?
      

  2.   

    试试
    System.Web.HttpUtility.UrlEncode("8/14/2005", Encoding.UTF8);
      

  3.   

    我看了一下,我机器上的System.Web namespace里确实没有HttpUtility class
    只有三个class.
    AspNetHostingPermission
    AspNetHostingPermissionAttribute
    AspNetHostingPermissionLevel
    那为什么呢?MSDN的System.Web 里确实有HttpUtility。那我需要更新我的类库马?怎么更新呢?谢谢!
      

  4.   

    在我的机上没问题. 楼主可以试着添加引用 System.Web.dll 看看.
      

  5.   

    以下是我的 \WINNT\Microsoft.NET\Framework\v1.1.4322\csc.rsp 文件的内容:# This file contains command-line options that the C#
    # command line compiler (CSC) will process as part
    # of every compilation, unless the "/noconfig" option
    # is specified. # Reference the common Framework libraries
    /r:Accessibility.dll
    /r:Microsoft.Vsa.dll
    /r:System.Configuration.Install.dll
    /r:System.Data.dll
    /r:System.Design.dll
    /r:System.DirectoryServices.dll
    /r:System.dll
    /r:System.Drawing.Design.dll
    /r:System.Drawing.dll
    /r:System.EnterpriseServices.dll
    /r:System.Management.dll
    /r:System.Messaging.dll
    /r:System.Runtime.Remoting.dll
    /r:System.Runtime.Serialization.Formatters.Soap.dll
    /r:System.Security.dll
    /r:System.ServiceProcess.dll
    /r:System.Web.dll                           <--------------- 注意这一行
    /r:System.Web.Mobile.dll
    /r:System.Web.RegularExpressions.dll
    /r:System.Web.Services.dll
    /r:System.Windows.Forms.Dll
    /r:System.XML.dll
      

  6.   

    那应该是我版本的问题,而且我机器里面没有\WINNT\Microsoft.NET\Framework\v1.1.4322\csc.rsp 这么个文件。我重新安装另外一个版本看看。