Home > DeveloperSection > Blogs > Encode - Decode in ASP.NET

Encode - Decode in ASP.NET


ASP.Net ASP.Net 
Ratings:
0 Comment(s)
 3029  View(s)
Rate this:

Encode and Decode in ASP.Net

 

Html Encode method encodes a particular string to be displayed in a browser. It is important to encode strings prior it’s rendering in the page, mainly to avoid cross-site script injection (XSS) and HTML injection attacks. However, developers so often forget to call the encode function.

Html Decode method decodes a particular string which is encoded.

Encoding and decoding is needed in somewhere like

·         Pass the values from one page to another.

·         Access the URL or pass the URL.

·         Fetch the data or insert data in Database.

·         Read the xml data or insert data in xml.

·         Change the special character from string

·         And security purpose etc.

 

In ASP.Net we used the following encode and decode method:

·         Server.HtmlEncode()

·         Server.HtmlDecode()

·         Server.HtmlUrlEncode()

·         Server.HtmlUrlDecode ()

·         HttpUtility.UrlEncode()

·         HttpUtility.UrlDecode ()

 

Check details here:

http://www.mindstick.com/Articles/b3d1fb4c-f386-49af-a464-fc96467eb957/?Encoding%20and%20Decoding%20in%20ASP%20Net

 

 


Don't want to miss updates? Please click the below button!

Follow MindStick