AuthorQuestion
C# directory path name contains invalid character
Posted on: 19 Nov 2012
In a C# 2008 application, I want this program to point to a executable that it needs to run called 'client.exe' as indicated by the app.config file value I listed below. My problem is the part of the directory path called 'co1 & co2' has an illegal charcter in it which is the '&' part. The production location has this name in it.

Thus can you tell me how to change the '&' part of 'co1 & co2' so that the & will be a valid part of the directory path?

Here is the app.config file I am referring to:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <appSettings>  
      <add key="client_location" value="C:\Program Files (x86)\co1 & co2\client.exe" />
    </appSettings>   
</configuration>

[ + ]
AuthorReply
Vulpes
  • 0
  • 0
accepted
Re: C# directory path name contains invalid character
Posted on: 19 Nov 2012   Accepted Answer
Not sure whether Mahesh's solution will work or not.

I'd have thought you'd need to change:

  & to &amp; 

for the XML file to be valid.

Re: C# directory path name contains invalid character
Posted on: 19 Nov 2012  
I think you use double & (&&) if I remember correctly.
Admin
Being Humble is a virtue, not weakness!

Get Career Advice from Experts
SPONSORED BY
  • PDF reports have never been easier to create. With our included WYSIWYG Designer, you can layout your reports, set up your data source and let DynamicPDF ReportWriter do the rest.
Get Career Advice from Experts