Error
-
When i assign the html table to the hiddenfield value using javascript i am getting the error like this: "A potentially dangerous Request.Form value was detected from the client (ctl00$ContentPlaceHolder1$hd2="<TBODY> <TR> <TD c...")." I used the javascript function like this: var element = document.getElementById("aspnetForm"); var store1 = document.getElementById("tb1"); document.getElementById("ctl00_ContentPlaceHolder1_hd2").value = store1.innerHTML.toString(); Help me how to solve this
-
When i assign the html table to the hiddenfield value using javascript i am getting the error like this: "A potentially dangerous Request.Form value was detected from the client (ctl00$ContentPlaceHolder1$hd2="<TBODY> <TR> <TD c...")." I used the javascript function like this: var element = document.getElementById("aspnetForm"); var store1 = document.getElementById("tb1"); document.getElementById("ctl00_ContentPlaceHolder1_hd2").value = store1.innerHTML.toString(); Help me how to solve this
Having angular braces "<" with in a text box, hidden field, text area, etc., triggers this error during server post. ASP.NET engine thinks that malicious code has been injected into the request stream and stops processing the request and raises this error, when it encounters such a situation. To over come this, either replace the angular braces with their HTML code "<" - & l t ; ">" - & g t ; [with out the spaces] or else set
ValidateRequest="false"
on the page directive of the page. This web page has examples for both solutions Allowing HTML Formatted User Input in ASP.NET [^] NOTE: The later would make your page susceptible to injection attacks. -
Having angular braces "<" with in a text box, hidden field, text area, etc., triggers this error during server post. ASP.NET engine thinks that malicious code has been injected into the request stream and stops processing the request and raises this error, when it encounters such a situation. To over come this, either replace the angular braces with their HTML code "<" - & l t ; ">" - & g t ; [with out the spaces] or else set
ValidateRequest="false"
on the page directive of the page. This web page has examples for both solutions Allowing HTML Formatted User Input in ASP.NET [^] NOTE: The later would make your page susceptible to injection attacks. -
I made the validationRequest property to false now the problem is solved but the table is displaying along with the td and tr tags in excel how can i solve this
What exactly are you trying to do?? Your original post has nothing about writing to an excel!?
-
What exactly are you trying to do?? Your original post has nothing about writing to an excel!?
i want to import the html table that is dynamically generated to excel to get the table i am using the javascript function and i am using the value stored in hidden field to display in excel string html = hd2.Value; Response.Cache.SetExpires(DateTime.Now.AddSeconds(1)); Response.Clear(); Response.AppendHeader("content-disposition", "attachment;filename=FileName.xls"); Response.Charset = ""; Response.Cache.SetCacheability(HttpCacheability.NoCache); Response.ContentType = "application/vnd.ms-excel"; this.EnableViewState = false; Response.Write("\r\n"); Response.Write(html); Response.End();