web-config

VS 2010 Web.config transformations for debugging

I’m a fan of the new VS 2010 Web.config transformations. I use this feature for deployment purposes and wondered if it is possible to use them for debugging too. I think of using them in the IDE: I want to create different built configuration (with linked transformation configurations); choose one of them; start the web site in the IDE ...

ASP.Net forms authentication - multiple providers

I have an ASP.Net 4.0 application, and within it is a folder called "Forum", setup as a sub application in IIS 7. This forum package implements a custom provider for .net membership. The forum is running in .net 3.5. I'd like to setup the main site so that when users login, it logs them into both my site and the forum site. Both the main...

Visual Studio 2008: No Intellisense in web.config

Hey all! My web.config no longer has Intellisense nor colour highlighting. It looks like a regular text document. Any idea why this would occur? Thanks! ...

ASP.NET Web.config transformation won't work in installer

I am working on an ASP.NET project in Visual Studio .NET 2010 and attempting to make an MSI installer using a Web Setup Project. I added the Primary output from the project (which seems to pull in the relevant dependencies) and the Content Files from the project (which pulls in the Web.config and the .svc files). The issue is that ra...

Reading membership section from web.config in C#

Hi there, I have created a custom MembershipProvider class, so far so good, however, I am not sure how to read the configuration settings from the web.config file. I tried to search from Google and Stackoverflow, seems like someone also experiencing my problem and asked, but no answer has been given. It should be a simple thing, but ...

Changing IIS URL Rewrite config location

Hi When used at site level, the IIS7 URL Rewrite 2 module saves its configuration in the web.config file of that site. I'm using Sitecore CMS, and best practice is to store any web.config customisations in a separate config file for ease of upgrading, staging/production setups etc. Is there any way to specify a different config file fo...

How can I handle maxRequestLength exceptions elegantly?

In my ASP.NET MVC (v2 if it matters) app, I have a page that allows the user to upload a file. I've configured the maxRequestLength for my app to allow files up to 25MB. As a test, I send it a 500MB file which throws the exception: Maximum request length exceeded. (I only know this because ELMAH catches the error and logs it.) In my w...

Can Log4net have multiple appenders write to the same file?

I'm using a RollingFileAppender to log some info to a file with a conversionPattern (in the web.config) that looks like this for the header of each log section: <conversionPattern value="%date - %property{userId} - %property{method}%newline--------------------------------%newline%message%newline%newline"/> I'd like to log details unde...

How to configure a CustomBinding to use a CustomMessageEncoder in a config file.

Hello, I have a CustomBinding and a CustomMessageEncoder, CustomMessageEncoderFactory and a CustomMessageEncodingBindingElement. I want my CustomBinding to use this CustomMessageEncoder. But how can I configure this in my config file? Thanks, Michiel ...

.NET: How .config files works?

For me it a little bit hard and frustrating to understand how app.config, web.config files work on deep level. Is it any document which can describe format, internal implementation and parsing of .config file. ...

How to keep multiple connectionString passwords safe, separate, and easy to deploy?

I know there are plenty of questions here already about this topic (I've read through as many as I could find), but I haven't yet been able to figure out how best to satisfy my particular criteria. Here are the goals: The ASP.NET application will run on a few different web servers, including localhost workstations for development. This...

Getting name of configuration section registered for a certain type in .net

I have a custom configuration section for a library, and I would like to load my configuration object from the library itself. Am I obliged to fix the configuration section group and name, e.g. <?xml version="1.0" encoding="utf-8" ?> <configuration> <configSections> <sectionGroup name="MyGroup"> <section name="MySection" typ...

How to read system.web section from web.config

Should be simple, but whatever I try returns null: const string key = "system.web"; var sectionTry1 = WebConfigurationManager.GetSection(key); var sectionTry2 = ConfigurationManager.GetSection(key); I'm sure I have done this before. I am using MVC if this makes a difference. ...

VS 2010 web.config transformation

Hi all, I need help on web.config transformation as I'm trying to do something not documented. My web.config has an empty connectionStrings element. In debug, I'd like the transformation tool to add a configSource="file.local" to the connectionStrings element. But in release, I'd like it to add a connectionString element. So, to summa...

Customize a WCF RIA Services Endpoint

Is it possible to customize the parameters of a WCF RIA Services endpoint? Specifically, I would like to create a custom binding for the endpoint and increase the maxReceivedMessageSize to allow sending the contents of a file that is a few megabytes in size. I've tried meddling in the web.config, but I'm getting the following error: ...

How to test asp.net location folder authorization programmaticly

I have an location element in my web.config like so: <location path="Admin"> <system.web> <authorization> <allow roles="Domain\Development"/> <deny users="*" /> </authorization> </system.web> </location> This works to only allow members of the development group access to this folder. I ...

how Create a exception in Authorization tag in web.config

How i create a exception in location to allow access to page GanttViewer.aspx with other rol and others pages only with Admin rol <location path="Admin"> <system.web> <authorization> <allow roles="Admin"/> <deny users="*"/> </authorization> </system.web> </location> ...

castle monorails httpHandlers

I have a question and I hope you can help me solve it... I have a castle monorails application. In web.config file in httphandlers I have *.aspx maped to monorails (my hosting does not suport other extensions...) <add verb="*" path="*.aspx" type="Castle.MonoRail.Framework.MonoRailHttpHandlerFactory,Castle.MonoRail.Framework"/> The pro...

extra AuthorizationRule in web.config AuthorizationSection

I'm trying to modify the list of allowed users in web.config from a codebehind. <authorization> <allow users="alice, bob"/> <deny users="*"/> </authorization> I successfully retrieve the section I need config = WebConfigurationManager.OpenWebConfiguration("~"); authSection = (AuthorizationSection)config.GetSection("system.w...

web.config transforms not being applied on either publish or build installation package

Today I started playing with the web.config transforms in VS 2010. To begin with, I attempted the same hello world example that features in a lot of the blog posts on this topic - updating a connection string. I created the minimal example shown below (and similar to the one found in this blog). The problem is that whenever I do a righ...