363,925 Members | 2615 Browsing Online
Community for Developers & IT Professionals
Bytes IT Community

How: Ampersand in AppSettings value??

Eidolon
P: n/a
Eidolon
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.


Jul 21 '05 #1
Share this Question
Share on Google+
3 Replies


Adrian Banks
P: n/a
Adrian Banks
Try &amp;

Adrian

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


Jul 21 '05 #2

Eidolon
P: n/a
Eidolon
> Try &amp;

that works... thanks!

- Aaron.


Jul 21 '05 #3

Ewen Phillips
P: n/a
Ewen Phillips
Aaron,

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

The following may be worth noting:-
http://msdn.microsoft.com/library/default.asp?
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]
Jul 21 '05 #4

Post your reply

Help answer this question



Didn't find the answer to your .NET Framework question?

You can also browse similar questions: .NET Framework