Url encoding in C#

September 15, 2009 ASP.NET C# Snippet
string encoded = System.Web.HttpUtility.UrlEncode("string to encode");
If you're planning to do this from a win form application, be sure to add System.Web as a reference.

Related posts: