Asp.net - Class Needs Info From Either The Web.config Or App.config

Jul 6, 2011

Our main application has both a asp.net and winforms component. There is a class that is used by both sides and needs info from either the web.config or app.config files. The class itself does not know if it's on the client side or on the web server (at this point). We are getting errors when it's attempting read app.config when it's on the web side. Is there a way for the class to tell if it needs to read web.config or app.config?

View 1 Replies


ADVERTISEMENT

Asp.net - Getting Configuration Settings From Web.config/app.config Using Class Library

Mar 26, 2009

I have a class library (Named ADI), that needs some configuration settings from the project using it (like connectionstring, filesystem locations etc).

I want to define these settings in my Windows Forms/Web Projects App.Config or Web.Config, like other settings.

Here is part of my app.config for my windows forms application:

<applicationSettings>
<PhotoImportRobot.My.MySettings>
<setting name="ADIImageRoot" serializeAs="String">

[Code]....

View 3 Replies

C# :: Validate Dot Net Application Config File(ex, App.exe.config) On Console?

Jan 18, 2010

is there any tool to validate configuration file?

View 1 Replies

VS 2005 Store Secured FTP Site Info In App.Config?

Dec 9, 2010

know open an xml file into a datagrid. The xml file is stored in a secured ftp with username and password. Just as an example if the site ftp.mysitesite.com, with username "xxx" and the password "XXX" has the file 123.xml, then how do I load 123 into a datagrid. Is it possible to store these info to a variable in app.Config and use that variable to access the site?

View 5 Replies

Using App.config In A Class Library

Jun 30, 2008

I was dangerously close to high-jacking another thread, so I thought I should create my own. We make class libraries so we won't duplicate code, but what about settings? I have a large solution that I've created a project in for common material, which includes an app.config. The problem is that a class library isn't an "app" so my functions can't get to the values. How do I get around this?

View 20 Replies

.net - Using A Class Defined In App_Code In Web.config

Sep 6, 2011

I have a class named CustomWebAuditEvent defined in App_Code/CustomWebAuditEvent.vb and I'm trying to use it in a eventMappings of my Web.Config

[Code]...

View 2 Replies

Class Library Config File?

Sep 18, 2009

I have written a vb.net class library that pulls the url for a web service out of my.settings. However, at runtime it no longer bothers to read the class.dll.config file that it made.I want to deploy this dll in different environments and be able to custom choose the relative webservice via the class.dll.config file.

View 3 Replies

Config File On Class Library?

Mar 16, 2006

Got a solution with 3 projects, a Web Service, a WinForms (MyUI), and a Class Library (Foo).

MyUI calls methods in the DLL that access the web service. The DLL has project config settings that store the URL of the web service. I compile the solution and it compiles all 3 projects. In the DLL's bin dir it puts the foo.dll and foo.dll.config files. However, in the WinForms bin dir it puts the MyUI.exe, MyUI.exe.config, and foo.dll; it doesn't include the foo.dll.config. When I run the MyUI.exe from its bin dir, it appears to work, and is obviously getting the config settings from somewhere because it doesn't crash and successfully contacts the web service. However, if I copy the foo.dll.config file into the MyUI's bin dir, and change config settings and re-run, it appears to ignore my changes completely.

In the Class Library I setup the config settings through the project properties dialog under the Settings tab. I access them from code using My.Settings.

How do I modify the config settings post-compile?

View 1 Replies

Class Library Config Files And My.Settings

May 19, 2010

Say I have a Class Library project with its own .dll.config, and a forms application. I want to confirm that it is impossible to reference the .dll.config file from the .exe.config file and still use My.Settings.

For example: I have SomeClassLibrary project, with SomeSetting that I can access through My.Settings.SomeSetting. I also have SomeFormsApp project. This is what I want my SomeFormsApp.exe.config to look like:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>

[Code].....

From my readings, this seems impossible. I either need to copy the content of SomeClassLibrary.dll.config into SomeFormsApp.exe.config, which is tedious and error prone when copying from multiple class libraries, or I need to use ConfigurationManager, which bypasses My.Settings and its typed, Intellisensed goodness.

View 9 Replies

Class Library Getting Settings From Own App.config NOT The Application's?

Jun 2, 2009

I'm having trouble with my application settings and I'm wondering if anyone else has seen this.

I have a Librabry with a connection string. In the project for the library it has its own app.config:

<configSections>
<sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" >
<section name="OBInfrastructure.Settings" type="System.Configuration.ClientSettingsSection, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
</sectionGroup>

[Code]...

View 1 Replies

Class Library Project With A Config File?

Jan 19, 2012

I have a Class Library project with a appSettings.config file included into the project. The file is not embedded. So I have a ClassLibrary.dll with a appSettings.config beside in the bin.I have another project which is a Web Service. It has a reference on ClassLibrary.dll with a Copy Local=true. When I build the Web Service, the ClassLibrary.dll is brought into the bin of the Web Service. However, the .config doesn't follow.Do I need to do some postbuild event to copy the .config file or there is another setting I can set?

View 3 Replies

Unable To Access AppSettings From App.Config In A Class Library Project

Mar 1, 2012

I am trying to access appSettings using the following syntax and I have used it before in my many website projects but not in a class library project. In this class library project I cannot even access the AppSettings Keys. Is there any way I could access the AppSettings Key from my class? Is the class library project's app.config or project structure behave in a different way?

[Code]...

I have already added Project Reference to System.Configuration and imported in my class. When I run my code it says, "Object not set to an instance of any object".

View 2 Replies

.NET Config Files, Which One To Use

Aug 14, 2009

I have an .net addin that loads w/outlook. Being a .NET assembly, I naturally have a .config file that you would expect. From my previous research, I named my app.config file to be Outlook.exe.config because outook is the executing assembly, and naturally, that's where you would expect that. This for the most part is fine.

In some installations, and I am not sure as to the conditions why, My addin will hunt for the config file under the dll name in another directory. So, more clearly stated, Office is in its directory, and my addin dll is in its own. So: MyAddin.dll.config vs. Outlook.exe.config. So, fine, I just made 2 copies of the config file and covered both cases. Now, I find that the addin is hunting for Outlook.exe.config in MY program directory (not the outlook dir)

FYI I log which config file is being used using: [Code] So, can someone tell me WHERE it is determined where the config file is read from, and if I can "Force" it to be used from a certain location?

View 1 Replies

Access Web.config In A WCF?

May 12, 2011

I have a self-hosted WCF (as a Windows service), it has a web.config file.

Inside one of the functions, I have this code (which doesn't seem to work)[code]...

View 1 Replies

App.config Error?

Aug 5, 2009

I am getting the following error when i try to run my vb.net application on some other machine along with the related dlls and other files**********************************************************See the end of this message for details on invoking just-in-time (JIT) debugging instead of this dialog box.

************** Exception Text **************
System.Configuration.ConfigurationErrorsException: Configuration system failed to initialize ---> System.Configuration.ConfigurationErrorsException: The 'add' start tag on

[code].....

View 4 Replies

App.Config For WCF Service?

Jul 15, 2009

I want to write a WCF Service as a console app. How do I make the contents for the App.Config? Do I hand code it, or is there something that will generate it?I know that svcutil.exe will generate stuff for a client from the service and its config, but how do I build the config contents for the service?I have .net 3.5 At home I have VB 2005 Express At work I have VS 2005 Suite?

View 1 Replies

C# - Set WCF ClientCredentials In App.config?

Sep 16, 2010

Is it possible to set clientcredentials for an WCF in App.config?

I would like to avoid doing this:

Using svc As New MyServiceClient
svc.ClientCredentials.UserName.UserName = "login"
svc.ClientCredentials.UserName.Password = "pw"
...
End Using

Rather the login and password should be part of the configuration.

View 4 Replies

Correct Way To Add App.Config

Dec 7, 2011

I am new to VS 2010 and in my application I want to add an app.config to contain to variables.I have been adding the app.config through the solution explorer, add item, general tab, configuration file.However i have noticed each project creates a default app.config in the project folder but which doesnt show up in the solution explorer.

View 1 Replies

Use A Config File?

May 22, 2009

What i want to do is use a config file to save the value that a user sets in a Folder browser dialog so that i can use the directory they select to write to files in that directory

View 4 Replies

VS 2010 Using A Config?

Feb 29, 2012

Dim accConn As New OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" & ConfigurationManager.AppSettings("Access") & "")
<?xml version="1.0" encoding="utf-8" ?>

[code].....

View 1 Replies

Where To Use A Config.ini On Project

Aug 30, 2009

where i can use a config.ini on my project.

View 7 Replies

Edit Web.Config File

Aug 18, 2011

I'm attempting to update some values in the web.config file from code during an install process.So far I've found this for updating the connection string,[code]However I need to update another section and I'm not sure how. I have the settings for an email and I'm not sure how to update them. Relevant web.config section below, [code]

View 2 Replies

.NET 1.1 And .NET 2 Config Files Working Together

Jun 27, 2012

I have inherited a rather large project consisting of an application written in VB6 and several DLL's and ActiveX controls written in VB6, VB.NET 1.1 and VB.NET 2. I want to change one of the settings for one of the DLL's written in VB.NET 2 that is in its application.dll.config file, but it seems to be having no effect.My main VB6 application (I will call it Alpha) has a configuration file (Alpha.exe.cnfig) which contains settings used by my VB.NET 1.1 DLL (which I will call Bravo). After calling Bravo, Alpha calls Charlie (my VB.NET 2 DLL). However, even though I have changed the application settings in Charlie.dll.config in the subdirectory where the DLL lives, it has no effect. I have tried putting Charlie's settings in Alpha's config file but this causes Bravo to fail with an automation error (which I think is because the format of the config files changed from .NET 1.1 and .NET 2).[code]If I try putting the applicationSettings section under directly beneath the appSettings section (i.e. as another child element of the configuration element) in Alpha.exe.config then Bravo.dll fails.

View 1 Replies

Add App.config File To Project?

Apr 20, 2011

Can anybody tell me how can i add app.config file to the project?

i try add new item in the project but i can not see any app.config template.

View 5 Replies

Add My Own Object Into App.config And Read It?

Apr 10, 2011

I'm trying to add a new section to my app.config file under the applicationSettings section and then read it from my WinFroms VB.NET application.[code]...

View 1 Replies

App.Config Ignored After Pre-Build Event?

Mar 16, 2011

I have a solution with several projects and several developers, each with their ownenvironment (of course). To manage connection strings between each environment, I have created several app.config files for each environment: app.config.dev, app.config.qa, etcThe pre-build event simply copies the app.config.$(ConfigurationName) to app.config. This pre-build event is done for each project in the solution, and the connection string is included in each (including the test project).

View 2 Replies

App.Config On A Network Share?

Apr 26, 2011

Visual Studio 2008 / Windows 7 / .net framework 3.5 / Windows forms application

My applicaiton has the following App.Config:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>

[Code]....

View 1 Replies

App.config Setup And Deployment

Jan 31, 2011

how to setup my deployment project so that users can customize thier own settings in app.config? Which special folder in the File System browser should I add, Personal Data, Application Data, or Programs Menu? How do I add the app.config to the folder? What about the project output, should it also be in the same folder? If so, should the project output be taken out of the Application Folder, in other words, exist in one place? I tested my deployment and was shocked that the icon only opened on the test user's pc after installation. I have custom settings in the app.config file that have default values, but must be configurable for user specific settings.

View 3 Replies

C# - App.config Syntax For Structure?

Nov 6, 2009

I have difficulties figuring out a useful app.config structures for my program.What I am doing is writing a windows service, which watches several directories on a server for files being uploaded.My problem is making my program configurable for n folders when in each of those n folders, i need to watch for a different collection of filetypes

e.g. folder1: .dwg;
folder2: .dwg;.doc;.xls;

then when a new file is uploaded, for example a .dwg file to folder1,then i need to run program1 to convert the dwg to a dwf, and program2 to convert the dwg to a .swf.but that only if filetype is .dwg and folder = folder1. if a .dwg is uploaded for example to folder2, then it needs to be converted to a pdf.The closes i have come to make this configurable in a app.config file is this:

<Folder2 name="C:inetpubwwwrootCAFMFotos" filetypes=".dwg;.pdf;">
<action>
<add key="ExecutableAndPath" value="C:UsersMeDesktopverydocdwg2vec.exe"/>[code].........

I have difficulties bringing this to a usable from in app.config

View 1 Replies

C# - Turning Tracing Off Via App.config?

Nov 10, 2010

I'm trying to use System.Diagnostics to do some very basic logging. I figure I'd use what's in the box rather than taking on an extra dependency like Log4Net or EntLib.

I'm all set up, tracing is working wonderfully. Code snippet:

Trace.TraceInformation("Hello World")
App.config:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>

[Code].....

That doesn't make sense to me: I just have to declare an instance of the BooleanSwicth to be able to manage (disable) tracing via the .config file? Should I like ... use ... the object somewhere?

View 4 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved