web-config

log4net with ASP.NET 3.5 problems

I'm having some trouble getting log4net to work from ASP.NET 3.5. This is the first time I've tried to use log4net, I feel like I'm missing a piece of the puzzle. My project references the log4net assembly, and as far as I can tell, it is being deployed successfully on my server. My web.config contains the following: <configSections...

Programmatically register HttpModules at runtime

I'm writing an app where 3rd party vendors can write plugin DLLs and drop them into the web app's bin directory. I want the ability for these plugins to be able to register their own HttpModules if necessary. Is there anyway that I can add or remove HttpModules from and to the pipeline at runtime without having a corresponding entry in...

Setting up a backup DB server in ASP.NET web.config file

I currently have an asp.net website hosted on two web servers that sit behind a Cisco load balancer. The two web servers reference a single MSSQL database server. Since this database server is a single point of failure, I'm adding an additional MSSQL server for backup. I would like to setup my web.config files to write everything to b...

Web.Config Falling back to Global Config in Web Farm

Hi all, This problem has several of us stumped in the office. We are all new to deploying ASP.NET apps to a web farm, and I am fresh out of ideas. We have a web farm, and the application is copied on to all of them. However, we are having a problem.. An exception is being thrown when trying to get settings from appSettings. Upon furth...

How to compile a C# file outside of App_Code?

I'd like to stick a class down in my folder hierarchy. The scenario is too trivial to warrant it's own project or separate website. However, I hate to clutter my top-level App_Code with something that's used by a tiny corner of the site. Is there a way in web.config to include another file or folder in the compilation process? ...

Can you rename the App_Code folder?

I realize this would violate convention, but I'm curious to know if you can do this through configuration. Edit: I understand why I wouldn't want to do this. BUT, I do want to understand the internals of this time of project. ...

How can setup a friendly email name in the MailSetting section of web.config?

Currently I have: <system.net> <mailSettings> <smtp from="[email protected]"> <network host="localhost" port="25" /> </smtp> </mailSettings> </system.net> How can I change it so the email is sent with a name and not the email address only? ...

Help with using ConfigurationSection to properly read from a config file

I'm trying to create classes to read from my config file using ConfigurationSection and ConfigurationElementCollection but am having a hard time. As an example of the config: <PaymentMethodSettings> <PaymentMethods> <PaymentMethod name="blah blah" code="1"/> <PaymentMethod name="blah blah" code="42"/> <PaymentMethod name...

Web.config editing for Membership Role Authorization

I want to user Role based security through the authorization section in the web.config file. Using Membership, my application will allow for new Roles to be created, and thus, the pages they can access need to be set dynamically. Can I programatically alter this section in the web.config to manage this? If so, how? ...

Which areas of the web.config can i safely delete?

When beginning a new web project, i'm always a bit worried about removing pieces of the web.config. It seems there are more entries than ever with Net 3.5 SP1. Which bits of the .config do you delete for the following scenarios: WCF Web Service, no Javascript support Simple MVC Website EDIT Can someone document a basic list of thin...

Editing Web.config programatically

What is a good way to edit a Web.config file programatically? I looked into System.Xml but couldn't find any obvious answers. Incidentally, ctrl-k seems to insert a code sample tag in the input box here. This is a bit annoying as ctrl-k is typically (in Emacs and Cocoa applications) used for killing a line of text. ...

GAC Problem: Keep getting old version

I've created a simple httpModule, registered it on GAC and added it to the global web.config. I've made some changes to the module, updated the version and changed it also on the web.config. What happens is that i keep getting the old version. I've restarted the computer, removed it from the GAC, deleted the consumer app .net temp file...

ASP.NET: Where/how is web.config cached?

I read somewhere in the Microsoft documentation that the content of the ASP.NET's web.config is cached. If that is true, where is it cached - in memory or on disk? And a follow-up question: are there any performance considerations I have to make, if I have to access the web.config intensively? ...

ASP.NET: external custom config file in a virtual directory - how to?

I know that there at least two approaches to leverage the web.config file: using the configSource attribute which was introduced in .NET 2.0 - here is a good blog entry about it. The file attribute of the appSettings tag which lets you point to an external file with a relative path. Described in the MSDN documentation on the appSetting...

ASP.NET hostingEnvironment / shadowCopyBinAssemblies

Today I stumpled upon the shadowCopyBinAssemblies option in the hostingEnvironment tag. Appearently this attribute it is a web.config (system.web) configuration Boolean option indicating whether the assemblies of an application in the Bin directory are shadow copied to the application's ASP.NET Temporary Files directory. <hostingEnviro...

SQLMembershipProvider - Adding membership to an existing database. Setting permissions

I am adding membership-related schemas to an existing database (lets call it myDatabase) following those instructions. As a results the number of tables, views and stored procedures are being created in myDatabase. The next step is to modify web.config for the application to use CustomizedMembershipProvider <membership defaultProvider...

What user account does trusted_connection use in sql2008?

When I set trust connection = yes in my web.config, what user account does it use? Is it the 'NT AUTHORITY\NETWORK SERVICE'? Because I under security in Sql management, I see: NtAuthority/System only?? ...

How to find a server's machinekey if it wasn't set

Trying to transfer servers but a connection string is encrypted and there is no machinekey set in the web.config. Is there anyway to find out what the machinekey was on the old server so we can set it on the new server? ...

Custom Errors for "App" folders? (ASP.NET)

Where can I setup custom errors for directories in my application such as App_Code, App_Browsers, etc.? I already have customErrors configured in the web.config and that works as expected. For example, http://www.mysite.com/bla.aspx > redirects to 404 page but http://www.mysite.com/App_Code/ > displays "The system cannot find the fi...

Find cause of Redirect in ASP.NET?

I'm trying to put in an exception in my web.config so that one page does not require authentication. However, it still redirects to the login page. The question isn't how to setup the web.config. Why? Our system (for better or worse) has a bunch of instrumentation besides the web.config. We have global.asax and custom HttpHandlers. ...