In C#
using System; // Namespace
System.Uri -- Class Name
Uri.EscapeUriString or HttpUtility.UrlPathEncode --> to Encode actual Url path.
HttpUtility.UrlEncode("Stack Overflow") --> "Stack+Overflow" to encode query string parameters.
System.Uri.UnescapeDataString --> to Decode actual Url path or a string.
HttpUtility.UrlEncode("Stack+Overflow") --> "Stack Overflow" to encode query string parameters.
In JavaScript
encodeURIComponent --> to encode URI or QueryString data
example:
encodeURIComponent(uri);
decodeURIComponent --> to decode a string that was URI encoded with the encodeURIComponent
example:
decodeURIComponent(uri);