UrlEncode通过控制台应用程序? [英] UrlEncode through a console application?
本文介绍了UrlEncode通过控制台应用程序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
通常我只使用:
HttpContext.Current.Server.UrlEncode("url");
但是由于这是一个控制台应用程序, HttpContext.Current
总是会 null
。
But since this is a console application, HttpContext.Current
is always going to be null
.
有另一个方法,使用?
推荐答案
尝试此操作!
Uri.EscapeUriString(url);
无需引用System.Web。
No need to reference System.Web.
这篇关于UrlEncode通过控制台应用程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文