Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. Error

Error

Scheduled Pinned Locked Moved ASP.NET
helpjavascripthtmltutorial
5 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • 4 Offline
    4 Offline
    4anusha4
    wrote on last edited by
    #1

    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

    D 1 Reply Last reply
    0
    • 4 4anusha4

      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

      D Offline
      D Offline
      Dinesh Mani
      wrote on last edited by
      #2

      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.

      4 1 Reply Last reply
      0
      • D Dinesh Mani

        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.

        4 Offline
        4 Offline
        4anusha4
        wrote on last edited by
        #3

        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

        D 1 Reply Last reply
        0
        • 4 4anusha4

          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

          D Offline
          D Offline
          Dinesh Mani
          wrote on last edited by
          #4

          What exactly are you trying to do?? Your original post has nothing about writing to an excel!?

          4 1 Reply Last reply
          0
          • D Dinesh Mani

            What exactly are you trying to do?? Your original post has nothing about writing to an excel!?

            4 Offline
            4 Offline
            4anusha4
            wrote on last edited by
            #5

            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();

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups