web-config

Resources for understanding web.config essentials

What are the best resources for understanding what's possible (or not possible) to achieve using web.config settings. Wikipedia is really short on answers at this time and many of the sites I've browsed to only have one or two configurations referenced and explained. ...

How to use ConfigurationManager for DEBUG dn RELEASE versions in VS 2008 projects

Hi, i would like to use the "ConfigurationManager" settings, that i can create in VS 2008 ( see image ), to create different behaviors in my web.config or app.config files... for example i want to use different connection strings, if the "debug"-configuration is active, like: <configuration> <connectionStrings configSource="connecti...

Define the path to the "Bin" folder

Hi All, I have an ASP.Net project using AJAX that I am putting on a server behind a reverse proxy. Lets say my project is located on the server here: C:\inetpub\wwwroot\proj\app So the bin folder should be here: C:\inetpub\wwwroot\proj\app\Bin The reverse proxy causes the server to automatically look for the Bin folder for the proj...

Update configSource of XML element in web.config using Powershell by passing in Parameters

I am trying to figure out a way to update my web.config for different environments by updating the configSource for the appSettings element in the web.config. Here are the way I know how to do it. $xml.get_DocumentElement().appSettings.configSource = $replaced_test The problem is that I want one base script where I can pass in dif...

Storring data in web.config(custom section/appSettings element) vs storing it in a class

Hi. Why is it better to store data inside an appSettings element (or inside a custom section) of a web.config file than to store it in a class? One argument would be that by using custom sections we don’t have to recompile code when we change data, but that’s a weak argument, especially if we’re using Web Sites, which get recompiled...

Why do web.config override MetaBase.xml?

This might be a borderline Server Fault-question, but here goes. I have a IIS 6 where AspMaxRequestEntityAllowed="204800" in MetBase.xml, suggesting the upload file limit is 200kb, while <httpRuntime maxRequestLength="20192"/> in web.config allows for a 20mb upload - and the latter is what the application allows. Why do web.config over...

Pros and Cons of registering user controls in web.config vs. asp page.

Can someone please let me know the pros and cons of registering user controls in web.config vs. on top of asp pages? I am looking for performance issues in particular. Does having all the controls registered in web.config make the pages slower to load (even the pages that do not use these controls)? ...

Trying to open a section from the web.config spans a ConfigurationErrorsException: The entry KEY has already been added

Hi all, I'm trying to fetch some settings from my membership provider in my asp.net application (so that I don't have to duplicate the information in the appSettings section) but I am getting the following exception: System.Configuration.ConfigurationErrorsException: The entry 'MyMembershipProvider' has already been added. (C:\Inetpub\...

XML file replacement program? (web.config/WDP related)

I've been running into alot of limitations with the web.config replacement code in VS 2008's Web Deployment Project. Some of these seem to be: Sectionsgroups cannot be replaced, only sections. Now if I just knew what sections was. There seems to be some requirement behind the replacement. It's not just a "dumb" textual replacement. Thi...

ASP.NET - Resolve Loaded HttpHandler Path

In ASP.NET is there any way to programatically resolve the path to a loaded HttpHandler as it is defined in the Web.config? (i.e. SomeModule.axd)? ...

SharePoint Deployment web.config entry

I am new to sharepoint. I have to deploy an application from one server to another server (Test Server). Now I am using solution package to deploy the application. I have one problem in Deploying. In the web.config of the application there are entries like appsetting entries, safe control entries, endpoint entries for our own services an...

why are there 2 web.config files

someone sent me over a link to download the sample standard asp.net mvc sample, i noticed that there were 2 web.config files 1 in the root directory 1 in the views directory what is the reason for this? ...

Using the Web.Config to set up my SQL database connection string?

Can anyone help me out please? I'm confused. I want to set up my connection string so I can just call it from my Web.Config file. I need a way to call it from my code, please make a little example. :( I also need help on setting up the Web.Config file. I don't know what properties to use. Here's a screenshot of what my credentials a...

Can't access the configuration manager from my solution.

I have a three tier set-up. Someone suggested I should get the ConnectionString from the Web.Config file and I've got it set up like this: Now I'm trying to access the ConnectionString from my DAL tier, but I can't find the ConfigurationManager. How can I invoke my Connection string from here?: ...

Encrypt and Save the ASP.NET ConnectionString within the web.config using Medium Trust?

I have searched around Google and Stackoverflow but can't seen to come up with a solution for editing the web.config to encrypt and store a SQL Server connection string for an installation script. The link at Accessing the web.config in Medium trust seems to suggest that the following code would work instead of OpenWebConfiguration, ...

web.config custom ConfigurationSection and unnecessary verbosity

Unless I am doing something wrong, the way I am supposed to use ConfigurationSection, ConfigurationElement and ConfigurationElementCollection, would require me to format my configuration section like so: <serviceAuthorization> <credentials> <login username="system" password="password" mode="include"> <services> ...

How to restrict download of specified file types

I want to restrict my web app so that .ini files can not be downloaded/shown. Is this something I can set up in my web.config file? EDIT based on answer: I tried this in my config file: <system.web> <httpHandlers> <add verb="*" path="*.txt" type="System.Web.HttpForbiddenHandler" /> </httpHandlers> </system.web> ...bu...

Install AJAX without web.config?

I have a weird scenario, I need to use the AJAX ScriptManager and UpdatePanel on two specific ASP.NET 2.0 pages. The pages are in their own second-level directory (we don't want to make that directory a Virtual Directory). The root web.config is not AJAX enabled, and we don't want to change it. Is is possible to use AJAX here, and how? ...

Error tag in Web.config customerErrors section needs an Int32 statusCode?

I keep coming across web examples of setting up custom error pages, and people do things like this: <customErrors mode="RemoteOnly" defaultRedirect="GeneralError.aspx"> <error statusCode="401.2" redirect="4012Error.htm"/> </customErrors> I know that a 401.2 redirect has its own set of headaches, but IIS isn't complaining about tha...

Machine-variable web.config elements?

Is there a way, in the web.config, to specify machine-specific values? For example: in production I want the <customErrors> node to redirect to specific pages for displaying user-friendly error-handling pages, but in development, test, and staging, I want <customErrors mode="Off" /> so I can see as much detail as possible. Is this curre...