HttpUtility.UrlEncode in console application

后端 未结 7 1796
长情又很酷
长情又很酷 2021-02-03 21:45

I\'d like to use HttpUtility.UrlEncode in a console application, VB.NET, VS 2010 Beta 2.

System.Web.HttpUtility.UrlEncode(item)

Error message:

7条回答
  •  执笔经年
    2021-02-03 22:15

    System.Web is there, but seems Visual Studio doesn't sort by name by default. You'll need to click Component name column to get that list sorted.

    I was able to run this code:

    Console.WriteLine(System.Web.HttpUtility.UrlEncode(" ")); // +
    

    Just adding a System.Web reference, without System.Web.Extensions.

    Also, You should replace your target framework from .NET Framework 4 Client Profile to .NET Framework 4; go to Project >> Properties... >> Application tab

提交回复
热议问题