web-config

Writing a cross framework class, ConfigurationManager and ConfigurationSettings

I'm trying to write a little web.config reading class, and want it to be available for all .net framework solutions I am writing. Everything is going fine, except for .net 1.1 and below I need to use System.configuration.configurationsettings.appsettings and for after 1.1 am using System.configuration.configurationmanager.appsettings. ...

Fluent Web.Config

Has anyone made an attempt at something like similar to the Fluent-Nhibernate project except for web.config? Is this even plausible? ...

Read environment variables in web.config

Hi, Is there a way write code in web.config file using preprocessed function. Say I created environment variables like %Temp%, %WINDIR%. order to read these I can use the configurationManager class. But I dont want to use it. I woudl like to use a preprocessed function similar to timeStampPattern="{timestamp(local)}". Here timestamp(loc...

.NET Conditional Web Services

My C# application has three testing stages: alpha, staging and production. Each stage for my application has a sibling web service. The APIs for all three web services are the same. How could my application use the appropriate sibling web service based solely on alterations to the web.config file? The goal being to have very little dup...

Using web.config directory security and extensionless urls

Hi Guys, I'd like to use the built in directory security features built into the web.config to restrict access to child pages of a parent page. My structure is as follows: Members Members/News Members/Press Members/Movies Users should be able to have access to the members parent page, but not child pages. My problem is, because I ...

Problem with Commerce Server and ASP.NET Integrated Pipeline

I am using Microsoft Commerce Server 2007 and a custom ASP.NET 2.0 website. Everything works well in Classic Pipeline, but when I try to use the Integrated pipeline, it fails with the following error: Server Error in '/' Application. Request is not available in this context Description: An unhandled exception occurred duri...

How can I store server-level connection string in applicationHost.config?

I have a connection string that all of the applications on my site need to know about. I know that I can put it in machine.config or root-level web.config but let's say that those options are not available to me and the only thing I can do is to modify applicationHost.cofig. I have tried this and the connection string does appear in the...

Error trying to read Roles Section from Web.Config

When executing this line: Dim roleRedirectSection As LoginRedirectByRoleSection = DirectCast(ConfigurationManager.GetSection("loginRedirectByRole"), LoginRedirectByRoleSection) ...I get the following error: Message: "An error occurred creating the configuration section handler for loginRedirectByRole: Could not load type 'sitename.Lo...

Web Reference Endpoint URL and configuration question (Asp.Net)?

I have a project ("The Project") that references an external web service. I am then referencing that project in an ASP.Net web application ("The Web Application"). When I reference "The Project" in "The Web Application" the app.config is not copied over, which isn't a problem. Does "The Project" take care of know what endpoint to use? Ca...

Can I configure IIS 7 Logging using Web.config?

I want to configure IIS 7 logging options (log file format, request fields included, log file rollover, etc.) using a site-level Web.config file. Is this possible? I assumed system.webServer/httpLogging would let me do what I need, but there are only two attributes available on that element and no child elements. ...

How to manage configuration of components loaded via dependancy injection?

Hi, I am building a application which will use DI Framework to load components to fetch data, from various sources like external web service or DB. Now components will need some of application configuration like web service url or database connection string. Keeping all that stuff in Web.Config and passing it via constructor parameters i...

ASP.NET web.config Could not find the specified membership provider

Hi, I got this error message Could not find the specified membership provider Here's my web.config setting: <connectionStrings> <add name="MyConnectionString" connectionString="Data Source=MyHostName;Initial Catalog=MyDB;User ID=userid;Password=*****" providerName="System.Data.SqlClient" /> <add name="ADConnectionString" con...

App.config only for my developer machine.

Can I create app.config or web.config file that applies only to my developer machine, as opposed to using the default configuration files that are checked into source control? ...

Unable to connect to ADAM with Windows domain\username

I'm having some difficulty connecting to an ADAM instance from my Commerce Server 2007 ASP .NET solution, and I believe it relates to my config file somehow. The short version is that I can connect to ADAM through ADAM-ADSIEdit with my current username/password, but when I put this in my web.config i get "Parser Error Message: Logon fa...

How do you do a Web.Config "Constant?"

How do I avoid the same hard-coded string "applicationName="membershipSampleApp" that appears in multiple places in my web.config? <membership defaultProvider="AspNetSqlMembershipProvider"> <providers> <clear/> <add name="AspNetSqlMembershipProvider" type="System.Web.Security.SqlMembe...

Connection string based on location (c# + asp.net)

Hi I've got 3 connection strings in my app: <add name="DBConnectionString" connectionString=""/> <add name="ADConnectionString" connectionString="" /> <add name="TestDBConnectionString" connectionString="" /> now in the code i do: public static string DefaultConnection { get { // this is used so ...

Trying to configure web.config to allow dashes as parameters without success (.Net4 + MVC2)

Ok. This one must be silly: We have just migrated a project to Visual Studio 2010 (Release Candidate) + .Net 4 + MVC2. One of the reasons was that the customer has record IDs that include the "/" character, and using encoded slashes as route parameters was not allowed until .Net 4. (See http://stackoverflow.com/questions/591694/url-enco...

Load Web.Config as embedded resource inside a DLL in ASP.NET MVC

Following on from my earlier question around loading views from DLLs under ASP.NET MVC, I've come across the issue of having Views and Controls be strongly typed. An exception is thrown indicating that the type cannot be resolved. I found this article which describes implementing a web.config section which allows that strongly typed vi...

Visual Studio 2008 - Unit testing with web config settings

My web application depends on a web.config entry being a certain value (like FEATURE_ACTIVATED=true) so how do I test the function that reads this web.config entry? I'd like to avoid copying the web.config entries to an app.config in the unit testing project, as it takes extra effort to synchronize the files. ...

Is it possible to configure a location in Web.config to only allow local connections

Hi All, I've got a page in an ASP.Net app (its Mvc actually but not important) and I would like to only allow connections to this page from the local machine. I would love to do something like this in Web.config: <location path="resources"><system.web><authorization><allow ips="local"/></authorization></system.web></location> I kn...