Server.UrlEncode(s);
.NET strings are Unicode strings (UTF-8 encoding, to be specific), so you only need to call HttpServerUtility.UrlEncode (although the so-called "internal" server property will be available in most contexts in asp.net, where you can do it).
source
share