strings with quotes in

Discussion in 'ASP General' started by Giles, Apr 3, 2007.

  1. Giles

    Giles Guest

    < input type=text name="PageTitle" id="PageTitle"
    value="<%=strPageTitle%>" >

    How do I "escape" any quotes, accidental carriage returns etc that are
    contained within strPageTitle? Do I have to use a series of replace()
    functions, or is there a cunning way that makes it OK?

    (Using escape(strPageTitle) fills the box with % signs...)

    Thanks in advance
    Giles
    Giles, Apr 3, 2007
    #1
    1. Advertising

  2. Giles wrote:
    > < input type=text name="PageTitle" id="PageTitle"
    > value="<%=strPageTitle%>" >
    >
    > How do I "escape" any quotes, accidental carriage returns etc that are
    > contained within strPageTitle? Do I have to use a series of replace()
    > functions, or is there a cunning way that makes it OK?
    >
    > (Using escape(strPageTitle) fills the box with % signs...)
    >
    > Thanks in advance
    > Giles

    value="<%=server.htmlencode(strPageTitle)%>" >
    --
    Microsoft MVP -- ASP/ASP.NET
    Please reply to the newsgroup. The email account listed in my From
    header is my spam trap, so I don't check it very often. You will get a
    quicker response by posting to the newsgroup.
    Bob Barrows [MVP], Apr 3, 2007
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Chris White

    Quotes/Double Quotes in Image Control

    Chris White, Sep 22, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    4,835
    Hermit Dave
    Sep 22, 2004
  2. Chris
    Replies:
    1
    Views:
    13,608
    Oisin
    Mar 24, 2006
  3. Lawrence Tierney

    Multiline quotes - escaping quotes - et al

    Lawrence Tierney, Dec 24, 2003, in forum: Java
    Replies:
    3
    Views:
    4,483
    Andrew Thompson
    Dec 24, 2003
  4. jOhn
    Replies:
    1
    Views:
    212
    Phlip
    Jan 29, 2008
  5. Richard Sandoval
    Replies:
    5
    Views:
    192
    7stud --
    Apr 26, 2011
Loading...

Share This Page