Use of UrlEncode and UrlDecode Method in Asp.net

Use of UrlEncode and UrlDecode Method in Asp.net

Use of UrlEncode and UrlDecode Method in Asp.net

UrlEncode Method :

HttpUtility.UrlEncode(string)
Ex:
string encodedText= HttpUtility.UrlEncode(txtrefcode.Text.Trim())
string url = “Test.aspx?enc=” + encodedText;
Response.Redirect(url);

UrlDecode Method :

HttpUtility.UrlDecode(Encoded String);
Ex:
string decodeValue = HttpUtility.UrlDecode(Request.QueryString[“enc”]);

Comments

No comments yet. Why don’t you start the discussion?

Leave a Reply