How: Ampersand in AppSettings value??

Ask a Question related to ASP.NET Security, Design and Development.

  1. #1

    Default 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.


    Eidolon Guest

  2. Similar Questions and Discussions

    1. Web.Config and appSettings tag
      I am storing a database connection string in a key/value pair in the appSettings tag of the web.config file as follows: <appSettings> <add...
    2. output ampersand using XML::Twig
      Dave Roe wrote: Be sure to read the fine prints then (or at least to test your code carefully after setting the option, I am not sure the fine...
    3. Ampersand in mailto: email address
      Hi, We have a text file which gets read into a flash movie so we can change to the content of a page without recompiling the movie everytime. ...
    4. ampersand problem when passing multiple parameters in URL
      Hi, when I try to pass some parameters in an URL, I always get an URL where the ampersand is represented as '&amp;'. I tried: $url =...
    5. appSettings problem!
      Hello! I have one problem with the appSettings on win2k srv machine with framework 1.1. Following line not work anymore (it worked fine with...
  3. #2

    Default Re: Ampersand in AppSettings value??

    Try &amp;

    Adrian

    "Eidolon" <aabdis@yahoo.com> wrote in message
    news:eDlAFgtdDHA.2932@tk2msftngp13.phx.gbl...
    > 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 Guest

  4. #3

    Default Re: Ampersand in AppSettings value??

    > Try &amp;

    that works... thanks!

    - Aaron.


    Eidolon Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139