473,569 Members | 2,572 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

help to put directory path to app.config file

Please help to put directory path to app.config file!

//DirectoryInfo di = new DirectoryInfo(" C:\\Vicky Development\\Fu ndExplorer\
\Index\\Copy of IntlIndex");

//string dipath = @"C:\Vicky Development\Fun dExplorer\Index \Copy of
IntlIndex";

//DirectoryInfo di = new DirectoryInfo(d ipath);

System.Configur ation.AppSettin gsReader appReader =

new System.Configur ation.AppSettin gsReader();

string diPath = (string)appRead er.GetValue(

"DirectoryPath" ,typeof(string) );

DirectoryInfo di = new DirectoryInfo(d iPath);

// Get a reference to each file in that directory.

FileInfo[] fiArr = di.GetFiles();

----------------------------------------------------------
in app.config file, it looks like below, it seems complain "\\" or @

Could anyone help what should be the right syntax?
Thanks a lot!
----------------------------------------------------------------
<add key="DirectoryP ath" value=@"C:\Vick ydDevelopment\F undExplorer\Ind ex\
Copy of IntlIndex"; />

--
Message posted via http://www.dotnetmonster.com
Nov 17 '05 #1
5 25472
"Vicky via DotNetMonster.c om" <fo***@nospam.D otNetMonster.co m> wrote in
message news:f2******** *************** *******@DotNetM onster.com...
<add key="DirectoryP ath" value=@"C:\Vick ydDevelopment\F undExplorer\Ind ex\>
Copy of IntlIndex"; />


Your app.config has VickydDevelopme nt instead of Vicky Development.

-- Alan
Nov 17 '05 #2
Hi,

You cannot modify app.config,

If you want to get a value stored there use
ConfigurationSe ttings.AppSetti ngs

ITOH you do not need to use @ in the XML file, all you have to do is enclose
the value in "

neither you need a ; at the end

<add key="DirectoryP ath" value="C:\Vicky dDevelopment\Fu ndExplorer\Inde x\Copy
of IntlIndex" />
cheers,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation

"Vicky via DotNetMonster.c om" <fo***@nospam.D otNetMonster.co m> wrote in
message news:f2******** *************** *******@DotNetM onster.com...
Please help to put directory path to app.config file!

//DirectoryInfo di = new DirectoryInfo(" C:\\Vicky
Development\\Fu ndExplorer\
\Index\\Copy of IntlIndex");

//string dipath = @"C:\Vicky Development\Fun dExplorer\Index \Copy of
IntlIndex";

//DirectoryInfo di = new DirectoryInfo(d ipath);

System.Configur ation.AppSettin gsReader appReader =

new System.Configur ation.AppSettin gsReader();

string diPath = (string)appRead er.GetValue(

"DirectoryPath" ,typeof(string) );

DirectoryInfo di = new DirectoryInfo(d iPath);

// Get a reference to each file in that directory.

FileInfo[] fiArr = di.GetFiles();

----------------------------------------------------------
in app.config file, it looks like below, it seems complain "\\" or @

Could anyone help what should be the right syntax?
Thanks a lot!
----------------------------------------------------------------
<add key="DirectoryP ath" value=@"C:\Vick ydDevelopment\F undExplorer\Ind ex\
Copy of IntlIndex"; />

--
Message posted via http://www.dotnetmonster.com

Nov 17 '05 #3
Alan,

Thanks you, good catch!

Vicky

--
Message posted via http://www.dotnetmonster.com
Nov 17 '05 #4
Ignacio,

Thanks a lot, I will give a try.

Vicky

--
Message posted via http://www.dotnetmonster.com
Nov 17 '05 #5
Ignacio,

It is working like a champ!
Thanks!

Vicky

--
Message posted via http://www.dotnetmonster.com
Nov 17 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
2601
by: Thilo Klein | last post by:
Hi, I have a managed app running from an unc path on the local intranet (Full trust is set for this path with the .NET Configuration mmc!). If the applications supplies both a .manifest and a .config file the settings in the config file are completely ignored. When I remove the manifest file the config file gets processed and vice versa. When...
2
933
by: Suresh Gladstone | last post by:
Hi, This is a bit with versioning and installation of the .NET dlls. I want to perform the following, 1. A third party application will be invoking my .NET dll through COM interop . For this I have used Regasm and registered the assembly in the registry with CODEBASE option. eg: regasm myDll.dll /tlb:myDll.tlb /codebase
4
1452
by: Metaljock | last post by:
Please forgive me if this question is not clear. I am not a .Net developer, I am just trying to get a .Net app to work with Citrix. I have a .Net app that runs on Terminal Services 2003 with Citrix Presentation Server 3.0. This app has a .config file that I am told MUST be in the same directory as the .exe. Is this true? Is there any way...
2
16618
by: Maziar Aflatoun | last post by:
Hi, I'm trying to protect one of my subfolders from Web.config file in my root folder. Here is my directory structure / // My shopping cart /admin // Shopping cart admin which needs to be protected Now in my Web.config how can I protect just the /admin folder (which is not a virtual directory) it's simply a...
8
34596
by: Subra Mallampalli | last post by:
Hi, I am trying to use <runtime> section within the web.config file. However, the contents of the <runtime> section seem to be ignored. What am i missing here? Is <runtime> section not used by web apps? Any help is greatly appreciated. Thanks,
7
1692
by: Rob Meade | last post by:
Hi all, I'm developing a mini Windows app in Visual Studio, and I'm a bit stuck. I'm more used to developing web based apps, and whilst still new at that have stumbled across something I cant seem to do - thus require your most excellent skills to resolve it for me :o) I have an xml file in my project and I need to access it when the...
0
807
by: skull_leader7 | last post by:
Hi all... I have a VB.NET project that compiles an .exe (for example test.exe) Visual Studio locates this .exe in a specific directory. If I create in this same directory a config file test.exe.config, and run test.exe here, everything works fine and the settings in test.exe.config are picked up just fine by test.exe However, if I take...
2
2250
by: enrique | last post by:
Hello everyone, I'm looking for a "directory path" solution that will allows me to test my app locally and then test on remote web server without having to update my web.config file each time I modify the file. In other words I'm storing the paths (for centralizing purposes) as custom <appSettings> in the web.config. expample (for local...
1
1216
by: Frank | last post by:
I am using Visual Studio.NEt 2003 and running aps.net v 1.1 I had a problem with a custom control as not being recognized in the machine.config file, so I decided to open it and simply take a look. It opened with Dreamweaver MX 2004 by default, and now I get : Configuration Error Description: An error occurred during the processing of a...
0
7700
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7614
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7924
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
1
7676
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
5219
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3653
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3642
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1221
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
938
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.