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. Prevent Cross-Site Scripting

Prevent Cross-Site Scripting

Scheduled Pinned Locked Moved ASP.NET
csharpasp-nettoolsquestion
2 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.
  • D Offline
    D Offline
    dataminers
    wrote on last edited by
    #1

    Acutually I want to prevent cross-site scripting in asp.net forums. If I want to protect from user input data when user (lamer) enter script in the textbox in asp.net forms. If I get to textbox string and convert the <, >, & symbol to HTMLEncoding in the string. Is this process enough for prevent cross-site scripting? Best Regards...

    D 1 Reply Last reply
    0
    • D dataminers

      Acutually I want to prevent cross-site scripting in asp.net forums. If I want to protect from user input data when user (lamer) enter script in the textbox in asp.net forms. If I get to textbox string and convert the <, >, & symbol to HTMLEncoding in the string. Is this process enough for prevent cross-site scripting? Best Regards...

      D Offline
      D Offline
      Dominic Pettifer
      wrote on last edited by
      #2

      Yes. But you ought to process HTML on the way out as it's getting displayed on screen rather than store it in the database in HTML encoded format. This ensures the database stores the data in a platform neutral format, also because some ASP.NET controls perform their own HTML encoding (such as the ToolTip property, or Text property for TextBox controls), and you'll end up encoding the encoding and the user will see < on the screen instead of < Use Server.HtmlEncode(outputString), but don't do this for control properties that already do their own encoding for above reason.

      Dominic Pettifer Blog: www.dominicpettifer.co.uk

      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