UrlEncode through a console application?

后端 未结 12 1238
我寻月下人不归
我寻月下人不归 2020-12-15 02:16

Normally I would just use:

HttpContext.Current.Server.UrlEncode(\"url\");

But since this is a console application, HttpContext.Curren

12条回答
  •  天涯浪人
    2020-12-15 02:49

    You'll want to use

    System.Web.HttpUtility.urlencode("url")
    

    Make sure you have system.web as one of the references in your project. I don't think it's included as a reference by default in console applications.

提交回复
热议问题