473,792 Members | 2,937 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Web.Config Get Config settings at runtime.

Hi
How do i access the settings defined in the web.config during runtime. GetConfig method is used to access the user defined sections. i would like to get the customErrors mode defined in the web.config from a code behind page. how do i achieve this

Thanks
Augustin
Nov 18 '05 #1
3 1543
Load the Web.Config into a XPathDocument object, and use XPath to
query the node and attribute you need.

Tommy,

"Augustin Prasanna. J" <an*******@disc ussions.microso ft.com> wrote in message news:<FE******* *************** ************@mi crosoft.com>...
Hi,
How do i access the settings defined in the web.config during runtime. GetConfig method is used to access the user defined sections. i would like to get the customErrors mode defined in the web.config from a code behind page. how do i achieve this?
Thanks,
Augustin

Nov 18 '05 #2
Hi,
Is there any other way to access the config settings other than parsing the file. would like to know if there are any classes availble in the API that can be used to read the settings.

Thanks,
Augustin
Nov 18 '05 #3
Check out the System.Configur ation namespace.

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Big things are made up
of lots of little things.

"Augustin" <an*******@disc ussions.microso ft.com> wrote in message
news:8A******** *************** ***********@mic rosoft.com...
Hi,
Is there any other way to access the config settings other than parsing the file. would like to know if there are any classes availble in the API
that can be used to read the settings.
Thanks,
Augustin

Nov 18 '05 #4

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

Similar topics

6
5957
by: Ajay Pal Singh | last post by:
Hi, I am creating a web service, which needs to take some actions based on the config file. I need a way to listen the changes as they occur in the config file so that the service can take appropriate action for the cahnges. Is there any way i can implement this. Thanks, Ajay
0
5910
by: Adam Getchell | last post by:
I'm attempting to write a custom Authentication module using http://www.15seconds.com/Issue/020417.htm I looked at http://support.microsoft.com/default.aspx?scid=kb;EN-US;307996, but it doesn't setup things the way I want (ie, I want to integrate into an existing web application). So I want to deny unauthenticated users access to everything except the default page. I have an error in web.config. When I comment out these lines: ...
3
1718
by: Mads Brydegaard | last post by:
Hi, I have created a custom Config handler for reading a custom config section in my .config file(s) It works very well! I have placed a web.config in my root directory and then I use sub files in sub diretories overriding various settings in the config file. Very nice strategy which really makes it easy to customize generic applications.
3
3871
by: Nuno | last post by:
At first, I was trying to encrypt ConnectionStrings in my app.config and still be able to modify my datasets. So, i had to modify the Settings.Designer.cs file to handle the decryption aspect in the GET properties. This works great to run the application but there are two problems with it when developing at designtime. 1. Anytime i add another setting to Properties, the Designer rewrites the Settings.Designer.cs overwritting my...
5
5736
by: Keith | last post by:
Hello all, I have a C# Windows Forms app. It is in namespace App.GUI. It builds to Nav.exe. I have entered an application level setting using the designer. Its type is string, name is "FOO" and value is "monkey". I've tried the following ways to retrieve the value and only one works: //Returns null Configuration config = ConfigurationManager.OpenExeConfiguration(Assembly.GetEntryAssembly().Location); string monkey =...
0
1334
by: davemills81 | last post by:
Hi, Does anyone know how to update the user or application settings of a dll after building? The problem I have is? I have recently developed a service in C# that attaches references a dll. Lets call it myDll.dll The dll has an app.config file that contains user and application
0
955
by: Eric | last post by:
I inherited some code that uses the settings designer to manage some app settings. One of the settings is a connection string that has a DefaultSettingValueAttribute with hard coded text for a connection string. I would like it to read from the app.config file at runtime, but am not sure how to get it to do that. I tried putting in code to read the config section in the attribute instead of the text, but it didnt compile. If I open the...
13
5375
by: Jonny Bergdahl | last post by:
I have a ASP.Net 2.0 web application that I am trying to debug. Problem is that I can't get the error message to show in the browser. It always returns the generic error message telling me to set customErrors="Off". Problem is I have already done that. I have tried to activate tracing as well, by setting trace enabled="true", but accessing the trace.axd page returns a message instructing me to do just that. I have tried to figure out...
6
4773
by: TS | last post by:
I cannot get this to work. I added an app.config to a project i reference from my web application project (vs 05) but can see no way to access the settings within it. the other thing is that I expected this config file (.dll.config) to get put in my web app's bin folder along with it's .dll file when i did a build, and that didnt' happen either. do I have access to the app.config in my project or is it worthless? If so why can i add...
10
1670
by: =?Utf-8?B?TUNN?= | last post by:
When creating a new VB Web Application Project with VS2008, there are several settings (compiler settings, option strict, etc) that appear both in the web.config file and "My Project". I'm wondering what takes precedent, what the benefit of using one vs. the other is, and what happens if they conflict?
0
10211
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10000
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7538
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6776
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 into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5436
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 the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5560
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4111
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3719
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2917
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 effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.