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. validation on string

validation on string

Scheduled Pinned Locked Moved ASP.NET
htmltoolshelpquestion
3 Posts 3 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.
  • G Offline
    G Offline
    gautamamit8
    wrote on last edited by
    #1

    Hi all I need to validate a string to allow html or simple text but not script language means a textbox can accept bold, italic tag of html but not script tag like alert("hi"); how can i do this Any help would be appreciated..

    Amit

    A 1 Reply Last reply
    0
    • G gautamamit8

      Hi all I need to validate a string to allow html or simple text but not script language means a textbox can accept bold, italic tag of html but not script tag like alert("hi"); how can i do this Any help would be appreciated..

      Amit

      A Offline
      A Offline
      Anurag Gandhi
      wrote on last edited by
      #2

      Just check the <script tag.

      if(txtBox.Text.Contains("<script")
      //This text contains script.//

      Anurag Gandhi.
      http://www.gandhisoft.com
      Life is a computer program and every one is the programmer of his own life.
      My latest article: Group GridView Data

      D 1 Reply Last reply
      0
      • A Anurag Gandhi

        Just check the <script tag.

        if(txtBox.Text.Contains("<script")
        //This text contains script.//

        Anurag Gandhi.
        http://www.gandhisoft.com
        Life is a computer program and every one is the programmer of his own life.
        My latest article: Group GridView Data

        D Offline
        D Offline
        DaveAuld
        wrote on last edited by
        #3

        It takes a bit more than that............ what about if the symbols are encoded, what about if the user puts whitespace between the symbol and the 's' there are various other things to think about. Search Google, there are various articles relating to Validating User Input and limited HTML; e.g. http://www.brainhandles.com/techno-thoughts/form-validation-php-html[^]

        Dave Find Me On: Web|Facebook|Twitter|LinkedIn CPRepWatcher now available as Packaged Chrome Extension, visit my articles for link.

        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