HttpUtility.URLEncode Method:
HttpUtility.UrlDecode Method is used to encode the URL including query string.
HttpUtility.UrlDecode Method is also used to encode bytes in a stream.
When the punctuation, blank spaces are passed into URL to receiving end, it might produce a problem.
HttpUtility.UrlDecode Method by default uses UTF-8 format. When < and > para
This is also equivalent to HttpUtility.UrlEncode it also facilitates string passed to URL, moreover it also help us to encode blank spaces, blank spaces are converted into plus (+) sign. HttpUtility.UrlDecode will perform the reverse action.
meters are passed into a string to pass URL then they encoded like %3c and %3e correspondingly. HttpUtility.UrlDecode Method is also used to encode bytes in a stream.
When the punctuation, blank spaces are passed into URL to receiving end, it might produce a problem.
HttpUtility.UrlDecode Method by default uses UTF-8 format. When < and > para
This is also equivalent to HttpUtility.UrlEncode it also facilitates string passed to URL, moreover it also help us to encode blank spaces, blank spaces are converted into plus (+) sign. HttpUtility.UrlDecode will perform the reverse action.
Vb Code Snippet Sample
public static string UrlEncode(string str) { //Declare variable string returnValue = null; //URL Encoding returnValue = HttpUtility.UrlEncode(str); //return urlencoded value return returnValue; } public static string UrlDecode(string str) { //Declare variable string returnValue = null; //URL decoding returnValue = HttpUtility.UrlDecode(str); Serve //return urldecoded value return returnValue; }
C# Code Snippet Sample
using System.Web; public static string UrlEncode(string str) { //Declare variable string returnValue = null; //URL Encoding returnValue = HttpUtility.UrlEncode(str); //return urlencoded value return returnValue; } public static string UrlDecode(string str) { //Declare variable string returnValue = null; //URL decoding returnValue = HttpUtility.UrlDecode(str); Serve //return urldecoded value return returnValue; }
Server.URLEncode Example
<%Response.Write(Server.URLEncode("http://www.technologycrowds.com")) %> http%3A%2F%2Fwww%2Etechnologycrowdst%2Ecom
Server.URLDecode will also perform the vice versa of Server.URLEncode. Server.URLEncode
is compatible with classic ASP that is why used in Classic ASP. Server.UrlEncode & Server.UrlDecode provides us backward compatible.
Conclusion:
If we use Server.URLEncode in classic ASP applications provide us backward compatible and HttpUtility.UrlEncode in new modern ASP.net web application, these Server utilities helps to Server cannot misinterpret our important data and can be represent our data real time as per our best requirements so server can understand our brilliant queries.
Post A Comment:
0 comments: