How: Ampersand in AppSettings value??

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Eidolon

    How: Ampersand in AppSettings value??

    I am wondering how i can put an ampersand character into the value attribute
    of a key in the appSettings section of my web.config file. If i try to
    simply type it in, then run my web app, i get the following error:
    ----------------------------------------------------------------------------
    ------------------------------------------------
    Parser Error Message: This is an unexpected token. The expected token is
    'SEMICOLON'. Line 70, position -3896.

    Source Error:

    Line 68: </system.web>
    Line 69: <appSettings>
    Line 70: <add key="specsheet"
    value="http://dev.domain.com/products/prodspecs.aspx? atrs=y&prodid=" />
    Line 71: </appSettings>
    Line 72: </configuration>
    ----------------------------------------------------------------------------
    ------------------------------------------------
    I've tried to escape the character as "\&" but that didnt do anything.

    Thanks in advance,
    - Aaron.


  • Adrian Banks

    #2
    Re: Ampersand in AppSettings value??

    Try &amp;

    Adrian

    "Eidolon" <aabdis@yahoo.c om> wrote in message
    news:eDlAFgtdDH A.2932@tk2msftn gp13.phx.gbl...[color=blue]
    > I am wondering how i can put an ampersand character into the value[/color]
    attribute[color=blue]
    > of a key in the appSettings section of my web.config file. If i try to
    > simply type it in, then run my web app, i get the following error:
    > --------------------------------------------------------------------------[/color]
    --[color=blue]
    > ------------------------------------------------
    > Parser Error Message: This is an unexpected token. The expected token is
    > 'SEMICOLON'. Line 70, position -3896.
    >
    > Source Error:
    >
    > Line 68: </system.web>
    > Line 69: <appSettings>
    > Line 70: <add key="specsheet"
    > value="http://dev.domain.com/products/prodspecs.aspx? atrs=y&prodid=" />
    > Line 71: </appSettings>
    > Line 72: </configuration>
    > --------------------------------------------------------------------------[/color]
    --[color=blue]
    > ------------------------------------------------
    > I've tried to escape the character as "\&" but that didnt do anything.
    >
    > Thanks in advance,
    > - Aaron.
    >
    >[/color]


    Comment

    • Eidolon

      #3
      Re: Ampersand in AppSettings value??

      > Try &amp;

      that works... thanks!

      - Aaron.


      Comment

      • Ewen Phillips

        #4
        How: Ampersand in AppSettings value??

        Aaron,

        Try using &amp; in place of the ampersand character or the
        decimal code equivalent.

        The following may be worth noting:-

        url=/workshop/author/dhtml/reference/charsets/charset1.asp

        Ewen.
        [color=blue]
        >-----Original Message-----
        >I am wondering how i can put an ampersand character into[/color]
        the value attribute[color=blue]
        >of a key in the appSettings section of my web.config[/color]
        file. If i try to[color=blue]
        >simply type it in, then run my web app, i get the[/color]
        following error:[color=blue]
        >----------------------------------------------------------[/color]
        ------------------[color=blue]
        >------------------------------------------------
        >Parser Error Message: This is an unexpected token. The[/color]
        expected token is[color=blue]
        >'SEMICOLON'. Line 70, position -3896.
        >
        >Source Error:
        >
        >Line 68: </system.web>
        >Line 69: <appSettings>
        >Line 70: <add key="specsheet"
        >value="http://dev.domain.com/products/prodspecs.aspx?[/color]
        atrs=y&prodid=" />[color=blue]
        >Line 71: </appSettings>
        >Line 72: </configuration>
        >----------------------------------------------------------[/color]
        ------------------[color=blue]
        >------------------------------------------------
        >I've tried to escape the character as "\&" but that didnt[/color]
        do anything.[color=blue]
        >
        >Thanks in advance,
        >- Aaron.
        >
        >
        >.
        >[/color]

        Comment

        Working...