473,395 Members | 1,656 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Read Machine.Config

Hi -
I'm trying to manually read and parse Machine.Config. When I try this I
recieve the following error:
Access to the path "C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\ " is
denied.

I am doing this by first getting the directory location of the framework and
passing it to a DirectoryInfo object. I can then use this object to move to
the Config folder. I suspect I only need to demand a permission in my code
but I'm not quite sure how to go about it. Unfortunately - using the built
in .NET methods to read .config files won't work for what I am doing so
accessing machine.config from my C# code is a must. Thanks!

Brian

---------<snip>---------

DirectoryInfo di = new
DirectoryInfo(System.Runtime.InteropServices.Runti meEnvironment.GetRuntimeDirectory());

di.MoveTo("CONFIG");

Nov 16 '05 #1
1 2970
Brian Patterson wrote:
Hi -
I'm trying to manually read and parse Machine.Config. When I try
this I recieve the following error:
Access to the path "C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\ " is
denied.

I am doing this by first getting the directory location of the
framework and passing it to a DirectoryInfo object. I can then use this
object to
move to the Config folder. I suspect I only need to demand a permission
in
my code but I'm not quite sure how to go about it. Unfortunately - using
the
built in .NET methods to read .config files won't work for what I am doing
so accessing machine.config from my C# code is a must. Thanks!


Basically, you're not intended to do this. Instead the expected mechanism is
to use ConfigurationSettings.GetConfig, but some sections will be excluded
from your access, and anyway the application config settings will override
any machine settings.

If you really do need access to machine.conf as a text file then you should
get the administrator to change the ACLs on the file (and/or folder).
However, there's a reason why those ACLs are applied and hence its not
always a good idea to change them.

So that lead to the question, why do you want to have direct access to
machine.config?

Richard
--
www.richardgrimes.com
my email ev******@zicf.bet is encrypted with ROT13 (www.rot13.org)
Nov 16 '05 #2

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

Similar topics

9
by: Marina Anufreichik | last post by:
Hi, After deploymnet web application on web server I can access page on local machine and login fine but when I'm trying to access web site from remote machine I can see login page, but when I'm...
7
by: | last post by:
In the beginning we had Ini files. Later we had registery files. Now have xml files and our read-only myapp.config file. My question now, is what is the best way to store and load user and...
1
by: vkrasner | last post by:
It works with VS2003 and does not in VS2005: in VS2003 : string sMyvalue = ConfigurationSettings.AppSettings; in VS2005 (does not work!!) string sMyvalue = ConfigurationManager.AppSettings; ...
4
by: Chris V | last post by:
I'm having a problem deploying my ASP.NET application to a WIN2k server. (IIS5 .NET 1.1) When I try to access ConfigurationSettings.AppSettings("WhateverValue") I get an "Object reference not...
7
by: Bob | last post by:
It's great that VS.NET makes it so effortless to add a web reference to a web service. The problem is, I haven't figured out a way to configure the URLs (or simply switch the references to another...
4
by: Josema | last post by:
Hi to all, Im searching a hand to solve an Exception that i get when i try to give the user to a gmail account... Any help would be appreciated.. Thanks in advance This is a piece of my...
2
by: Max Metral | last post by:
I'm trying to set the default behavior of customErrors in the machine.config. The documentation seems to suggest this should work, but it doesn't seem to work for me. On my development machine, I...
4
by: klynn | last post by:
Hi: I'm having problems reading a Microsoft Access file from my ASP.Net app on a Windows Server 2003 machine. The error message: The Microsoft database engine cannot open the file, <my_file>. It...
2
by: =?Utf-8?B?U2JhdGNodQ==?= | last post by:
How will i read connection strings in all web.config files in one particualr machine?
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
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...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.