Tuesday, November 13, 2012

Web.Config AppSettings Escape Parentheses

If you need to add entries to your web.config and are using connection strings or AppSettings with parenthesis or <,>,& you will need to escape these characters as they are invalid in XML markup.

A simple way to fix this is use an online HTML encoder. Simply copy paste your code into the encoder on this site: http://www.opinionatedgeek.com/DotNet/Tools/HTMLEncode/encode.aspx

Paste the output into your web.config markup. Run your program and your variable will load correctly!

1 comment:

  1. JetOleDb4ConnectionString" value="Provider=Microsoft.Jet.OLEDB.4.0;Data Source={0};Extended Properties=\"Excel 8.0;HDR=Yes;IMEX=1\"

    ReplyDelete