JavaScriptStringEncode : Javascript Compitable encoding
Hello, Recently I was facing very interesting issue. and the solution for the issue was introduced in the new updates in asp.net framework 4.0. Generally when we try to render HTML content on page clientside/ by javascript, it gives error of Potential dangerous content error. http://msdn.microsoft.com/en-us/library/ms972967.aspx There are lot's solutions but have to compromise security of page. by setting <%@ Page Language="C#" AutoEventWireup="true" CodeFile="default.aspx.cs" Inherits="_default" ValidateRequest="false"%> But now we have perfect solution which is introduced in .net framework 4.0 HttpUtility.JavaScriptStringEncode Method URL encoding makes sure that all browsers correctly encodes text in URL strings. Few Characters such as a question mark (?), ampersand (&), slash (/), and spaces might be truncated or corrupted by some browsers. Therefore, these characters must be encoded in a elem...