web-config

Enabling Intellisense for Custom Sections in .config Files

When editing .NET config files (app.config, web.config, etc) in Visual Studio, I get Visual Studio's intellisense to guide me when choosing my application's settings. If I add a custom configuration section, how can I enable intellisense for my custom settings? I'm sure there must be an easy answer to this, but a cursory Google search di...

Streamline web.config connectionString encryption

Is there a way to streamline the process of encrypting the connectionstrings after you deploy a web application? Here's the backstory. We manage many .NET websites. We move them to a development server and then eventually up to the production server. But after each site is created on the development box or the server box, I have to g...

IIS virtual directory from web.config

I have a IIS problem that I think this blog gives me a fix for: To resolve it, Right Click on the virtual directory - select properties and then click on "Create" next to the "Application" Label and the textbox. It will automatically create the "application" using the virtual directory's name. Now the application can be accessed. ...

Server-Specific web.config in website hosted from shared drive

Background Info: File Replication is Lame Currently, we have a massive, high-traffic ASP.NET web application load-balanced across 8 different IIS servers. Due to the nature of the site, minor changes to .aspx files and .ascx controls happen frequently throughout the day, and after being tested and published to live, are replicated out ...

How do I configure base class libraries in my app.config file?

I've found a couple of snippets of information pertaining to app.config/web.config that hints at almost codeless configuration of BCL components directly through the app.config. However, given the amount of tags suggested by the intellisense within the app.config, it suggests that there is a huge amount of possibilities for this that I ...

How to set Service Reference authorization?

How do you set the authorization for a Service Reference in web.config? I'm writing a password retriever, that sends the users password by e-mail. The e-mail is sent via a SOAP service reference. However, each time I try to declare a reference to the SOAP API the web app returns to the login page - the default action when you request so...

Could not load file or assembly 'log4net

Ok I am having a very odd issue when deploying one of our web applications to our live servers. Our application uses log4net to log a lot of actions quite heavily and after a couple of hours after being deployed we get the following exception. Could not load file or assembly 'log4net, Version=1.2.9.0, Culture=neutral, PublicKeyToken=b3...

Custom error handling for a specific page in ASP.Net

Hello friends. On a site I run, I have 404's and 500 errors mapped to redirect to a custom error page for end users; using the following code in my web.config: ... ... <system.web> <customErrors defaultRedirect="/404/default.aspx" mode="RemoteOnly"> <error statusCode="404" redirect="/404/default.aspx" /> </customErrors> ...

What's the most appropriate exception to throw if a required app/web.config configuration setting is not present?

(Asked by @tomhollander on Twitter) What's the most appropriate exception to throw if a required app/web.config configuration setting is not present? ...

Create a custom block in web.config for web.config with a random number of elements

I need to create a custom block in web config as follows: <MySettings> <add name="name1" value="value1" /> <add name="name2" value="value2" /> <add name="name3" value="value3" /> ... </MySettings> Ad i understand, i should derive my custom settings class from ConfigurationSection, but i don't know how to make it s...

Can I store ASP.NET MVC routes in web.config?

I'm looking for a method of storing routing information in my web.config file in addition to the Global.asax class. The routes stored in the configuration file would need to take higher precedence than those added programmatically. I've done my searching, but the closest I can come up with is the RouteBuilder on Codeplex (http://www.cod...

overwriting a web.config root file to enable customerrors tag

I have a situation where I want to catch 404 errors fired by HTML pages (not just aspx pages) but I only have access to the web.config of the root folder of my website, and all sub directories (note, i don't have access to the actual IIS server and I cannot create applications or change settings) So I did try the web.config customerrors...

Web.Config issue

Hi, i have a two webservers, REMOTE and LOCAL. I have multiple projects of which some are hosted on REMOTE, some on LOCAL and some on both. I have a problem configuring the following situation: http://REMOTE/ << contains 'main project' http://REMOTE/doubleproject/ << contains 'doubleproject' http://LOCAL/ ...

Is using a const in a class in App_Code quicker/faster than using appSettings in config.web on a webforms asp.net app?

im wanting to know the fastest way to access my globals... they will only change in the beta testing phase. before we go live. from then on they wont change ever. im thinking that there is an overhead in getting stuff from web.config also its neater code wise to write App.HostUrl instead of ConfigurationManager.AppSettings["HostUrl"].To...

Setting a custom 404 error page programmatically

In a regular ASP.NET application, you might have a customErrors section like the following: <customErrors mode="On"> <error statusCode="404" redirect="Nice-FileNotFound-Page.aspx"/> </customErrors> Is it possible to set the 404 error programmatically at Application_Start? Something like the following: // Figure out which page shou...

How can I define a variable as CONSTANT when retrieved from Web.Config?

I keep a lot of settings in AppSettings, and I was wondering if it's considered good practice to name them in UpperCase. Essentially, they're the same as Constants right? As I understand it, if you change the Web.Config, the app does a recompile. So, I was thinking, should you keep the settings in AppSettings in UPPERCASE (Assuming you...

Will a child application inherit from its parent web.config?

Hi I setup a IIS application from within an existing application. Will the parents web.config be inherited or is that something I have to set explicitly? ...

Avoid web.config inheritance in child web application using inheritInChildApplications

I am trying to add <location inheritInChildApplications="false"> to my parent web application's web.config but it doesn't seem to be working. My parent's web.config has: <configuration> <configSections> </configSections> // 10 or so custom config sections like log4net, hibernate, <connectionStrings> </connectio...

Is it possible to completely negate a "higher" web.config in a subfolder?

Is it possible to completely negate a web.config in a subfolder? Obviously, I have a web.config in the root. If I have a subfolder called "MyApp", can I write a bunch of code in there and have it run without any reference to the web.config at root? It would have its own web.config, and wouldn't even reference the "higher" web.config i...

Store and Retrieve values from web.config

I built a small website and there will be only one admin, so in the admin panel I am asking for a password with a value that I do not retrieve from a database, I just hard coded it in the function in code behind, I know this is wrong though I don't know why. So is hard coding it in web.config the right thing to do? and how? ...