Difference Between Setting.settings And Web.config

May 23, 2010

This might sound a bit dumb. I always had this impression that web.config should store all settings which are suspect to change post-build and setting.settings should have the one which may change pre-build.but I have seen projects which had like connection string in setting.settings. Connection Strings should always been in web.config, shouldnt it?I am interested in a design perspective answer.Just a bit of background:My current scenario is that I am developing a web application with all the three tiers abstracted in three separate visual studio projects thus every tier has its own .settings and .config file.

View 2 Replies


Similar Messages:

Unable To Read Config Settings From External Config Files

Sep 1, 2010

We are experiencing some strange behaviour on one of our ASP.NET web servers (Windows 2003 64-bit). After some activity, two third-party controls are unable to run correctly. One is log4net (it does not write error messages out) and the other is a menu control (it displays eval message instead of picking up its license). The one common thread is that both controls pick up their config from external config files (linked to from web.config).

Just wondering if anyone has any thoughts on this or experienced this in any way. Is it related to file/folder rights? The server has been running fine for a while and just started exhibiting this behaviour. Perhaps it occurs around the time the worker processes are recycled.

View 1 Replies

Read Settings / Sections From The Web.config Or App.config File?

Jul 8, 2010

I have many Connection strings in my web.config file. I also have a "dataConfiguration" setting in the same file which specifies what database my app connects to.

How do I read the "defaultDatabase" setting / section from the, see below xml file.
<configuration>

<configSections> [code]....

View 2 Replies

How To Determine Which Parent Config File Is Locking A Web.config Setting

Mar 15, 2011

When I open my ASP.NET site in IIS and try to open the .NET Trust Levels, I get an error message:

.NET Trust Levels There was an error while performing this operation.

Details:
Filename: ?C:inetpubwwwrootmyappweb.config
Line number: 445

Error: This configuration section cannot be used at this path. This happens when the section is locked at a parent level. Locking is either by default (overrideModeDefault="Deny"),or set explicitly by a location tag with overrideMode="Deny" or the legacy allowOverride="false".

I've checked a few places, but I haven't found anything that seems like it would be locking that setting. Is there a systematic way of determining where that setting is locked?

I'm using IIS 7.5 and .NET 3.5 sp1.

View 1 Replies

C# - Command Or Setting For A Child Web.config To Ignore The Parent Web.config

Jun 23, 2010

I am running into a problem with a web.config in a child project that has the same connection string setting as a parent. We have this in several of our web apps but there is one case where we want a child not to use the parent web.config. Is there a setting or command in the child web.config to ignore the parent web.config?

View 4 Replies

Store Config Settings For A .NET DLL (not EXE Or Web)?

Jan 19, 2011

I have a .NET 4 class library project, which is used by multiple web projects. In this class library I need to get a DB connection string and it needs to be the same for all the web projects. Currently I've got it as a setting in each web.config file, but this is not ideal. Is there any way I can have that configuration stored with the DLL, but still allow it to be modified at runtime (ie. hardcoding the connection string is out)?

App.config seems to be generally ignored for a DLL, even though it does get renamed to assemblyname.dll.config and copied to the bin directory for the web. I tried making it an "application setting" (ie. using the auto-generated class derived from System.Configuration.ApplicationSettingsBase) and this appeared to work, but changing the value in the DLL .config file at runtime had no effect, so I suspect it's really just using the hardcoded default value of the setting.

View 3 Replies

C# - How To Get The SMTP Settings Automatically From Web.config

May 4, 2010

I noticed that we always just are like:

SmtpClient mSmtpClient = new SmtpClient();
// Send the mail message
mSmtpClient.Send(mMailMessage);

And the only place the credentials are set are in web.config:

<system.net>
<mailSettings>
<smtp>
<network host="xxx.xx.xxx.229" userName="xxxxxxxx" password="xxxxxxxx"/>
</smtp>
</mailSettings>
</system.net>

So my question is, how does it automagically get them out?

View 3 Replies

Membership Roles Web.config Settings

Nov 25, 2010

I can't seem to find this answer anywhere on google or stackoverflow, even though I'd thought it would've been an easy thing to do.

I want to understand how the system.web authorization tag on the web.config works, and what exactly each attribute and property does.

For instance, what does

<system.web>
<authorization>
<deny users="?"/>
<allow users="*"/>
</authorization>
</system.web>

Specifically what I want to do is to disallow access to most of the site for unauthenticated users, allow access to some of the site for authenticated users who belong to a certain role, and allow full access to users from a second role.

View 2 Replies

C# - Best Way To Store Configuration Settings Outside Of Web.config?

Jun 6, 2010

I'm starting to consider creating a class library that I want to make generic so others can use it. While planning it out, I came to thinking about the various configuration settings that I would need. Since the idea is to make it open/shared, I wanted to make things as easy on the end user as possible. What's the best way to setup configuration settings without making use of web.config/app.config?

View 3 Replies

What I S Best Practice For Accessing Settings From Config

Feb 28, 2010

I want to know what best practice is for accessing settings in config file when you have dev/test/production types.

If you have different config for each type when you publish a ASP.NET website doesn't the config get copied as well??

View 3 Replies

Different Web.config Settings For Http And Https?

Feb 3, 2011

Is it possible to configure your web.config file of your asp.net website to use different settings for users accessing the site via HTTPS?

(eg. I need to have validateRequest attribute for https access set to false, but for internal access (using http) set to true...)

View 2 Replies

Configuration :: Settings For Web.Config File?

Sep 22, 2010

I am designing a web application for Leave Application of our faculties. There is a form in my website which represent the existing paper-back leave application form. Users(faculties) have to fill-up this web form and after validation an email will be send to the email address of our principal/hod. I hope that email address(s) will be provided to our group members. Now I want to know that what will be the required configuration of the web.config file? I found this blog ScottGu's Blog. Here the given configuration is:

[Code]....

But I think this is not acceptable for my project as the smtp from="test@foo.com", userName, password are unknown to me. So what should I do. Am I able to understand my requirement to you?

View 4 Replies

C# - Test Web.config Settings (especially Keys)?

Aug 10, 2010

whats a good way to test the settings (especially keys) in web.config? I think its not really testable with NUnit, or is it?Example: <add key="SomeKey" value="SomeValue" />

View 2 Replies

Read Web.config Settings In .aspx Page?

Nov 11, 2010

I've created a web page and it contains some settings value in web.cofig for example images.So i want to give the path of images in Web.Config file and file name in that particular image src. I wanted to read that settings only in aspx page not in codebehind. For example Web.Config: <add key="ImagePath" value=[URL]> and in my aspx page, <img id="ImgHeader" runat="server" src="<%ConfigurationManager.AppSettings["ImagePath"]%>" />

View 2 Replies

How To Read Web.config App Key Settings In HTML Markup

Oct 30, 2010

I have an ASP.NET site which uses a 3rd party activeX control. I have to pass a few parameters to the OBJECT tag in the HTML page. If i hardcode these parameters into the HTML everything works.

I would like to place the parameters in my web.config with app settings "key/value" pairs.

My problem is i cannot read the app key setting in the HTML markup to succesfully pass them in as parameters. I can read them fine from server side code behind.

What's the correct way to read these settings in the client side HTML markup ?

View 4 Replies

How To Read A Settings Value From The Web.config File In Application

Aug 18, 2010

I'm trying to use the following command:

Dim xmlFilePath As String = _
System.Configuration.ConfigurationManager.AppSettings("XmlFilePath")

to retrieve the following setting:

<applicationSettings>
<MySolution.WebProject.My.MySettings>
<setting name="XmlFilePath" serializeAs="String">
<value>C:ASP.NETFolderMessageLog</value>
</setting>
</MySolution.WebProject.My.MySettings>
</applicationSettings>

However, xmlFilePath shows up as Nothing after that line of code is run. What's the correct code to get a setting out of the web.config file in an ASP.NET application?

NOTE: Although you can add keys individually to the <appsettings> tag, I'm trying to figure out how to use it with the "Settings" tab in the project's properties.

View 2 Replies

C# - Automating Storing App Settings In Web.config (Refactoring)?

Jul 21, 2010

There are a bunch of hardcoded strings in a ASP.NET application.

eg. string constSetting = "XYZ";

There are a LOT of them. Is there a tool/plugin for Visual Studio 2008 to refactor it in such a way that the constant string goes into web.config and the above line gets replaced by the retrieved string from web.config app settings?

View 2 Replies

Storing Configuration Settings In Web.config Or Database?

Feb 15, 2010

What it best location to store various configuration settings of a web site modules. Creating class (that inherit ConfigurationSection) that map the settings in web.config file?Or creating some DAL and BLL clases that work with database?

View 5 Replies

Reading Settings From Separate Config File?

Feb 9, 2010

My asp.net app has is using a web.config for common configuration. I also have a section that maps some data objects to connection strings, and that section is going to be couple thousand of lines. I want to move that section to another config file "dataMappings.config", so I don't bulk up web.config - is there a standard mechanism of accessing that config file?

View 1 Replies

Configuration :: Site Settings File Vs. Web Config?

Nov 12, 2010

I've been thinking about this for a couple days but still would like some feedback on the best way to go about this:

I have multiple sites (domains) that will be running the same code. However, there are a couple settings I have in the appsettings web.config file which are relative to each site. (ie: defaultSiteTitle, emailFromAddress, etc).

I would like to deploy this application in only one location (folder) and point the domains in IIS to that one directory.

To do this, I believe I cannot use the web.config file to hold these settings...

So, I decided to make a SiteSettings.xml file and load the site settings in there:

<sites>
<oSite domain="abc.com" defaultSiteTitle="This is Site ABC" emailFromAddress="info@abc.com" />
<oSite domain="xyz.com" defaultSiteTitle="This is Site XYZ" emailFromAddress="info@xyz.com" />
</sites>

So when I need to access the site settings I just call a function in my datalayer that reads this xml file and via the httpRequest I pass it it determines which site settings to use.

Okay, that works when I call it from a page where I have the httpRequest...

Howver, now when I'm into some business layer functions say sendEmail and I need to find the emailFromAddress from the SiteSettings.xml file, I don't have the httpRequest. I know I could probably hack something together and pass it someway...

But I'm trying to figure out the best way to do this...

I don't really want to store it into session.

Is it possible to tell IIS what web.config file to look at, if I had multiple web.config files? (I don't think this is possible).

View 2 Replies

How To Send Mail Using SMTP Settings? With Out Web.config Entry

Mar 26, 2010

I want to send mail using SMTP settings. And it will not be configured in web.config. I want to set the SMTP settings at run time. How I can do this?

View 7 Replies

How To Retrieve Configuration Settings From The Web.config File Programmatically

Jun 17, 2010

I have this portion of my web.config file;

[Code]....

I need to be able to retrieve the value of "from" in my application. How do I read this value into my code?

View 3 Replies

Is It Redundant To Put Web.config App Settings Values Into The Cache Object

Aug 4, 2010

I thought I would put those settings into Cache and then invalidate them if the web.Config file changes. Reading some articles make it seem that this is completely unnecessary.

View 1 Replies

MVC :: MVC 3 Partial View Caching Not Honoring Web.config Settings

Jan 25, 2011

I posted a question on stack overflow about how partial view output caching issues:

[code]....

It errors out if you try to use a cache profileIf you turn off caching in the web.config. IT STILL CACHESThese settings work fine for normal view, just not partial view...

View 5 Replies

Do Web.config's Globalization Settings Affect Non-http Requests

Nov 15, 2010

In my ASP.NET application I set

<system.web><globalization culture="pl-PL" uiCulture="pl-PL" />

to have numbers and dates in this culture.

Surprisingly I noticed that methods invoked from job scheduler (Quartz library) use en-US? Why is that?

View 1 Replies







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