web-config

Why my HttpHandler is ignored?

Hi, In an ASP.NET application, I need to do some changes on every CSS file sent. So I created an HttpHandler (inside the app itself), added: <add verb="*" path="*.css" type="MyWebsite.CssTestHandler,MyWebsite"/> to Web.config in system.web/httpHandlers and modified the handler like this: public void ProcessRequest(HttpContext conte...

Can Web.config transformations be used with App.config files?

Sorry folks, my search fu was low when looking for a version of this question. It's asked and answered here: http://stackoverflow.com/questions/3004210/app-config-transformation-for-visual-studio-2010 Basically, the question above. The new config transformations that are provided for a web.config file for different environments are re...

Where do I set Response.TrySkipIisCustomErrors?

I working on a custom 404 page and keep getting a 500 error from IIS7. After doing some research I found I need to set "Response.TrySkipIisCustomErrors=true;" Where do I set that value? Can it be set in anyway with php or within the web.config file? my 404 web.config code is: <customErrors mode="On"> <error statusCode="404" redire...

web.config custom 404 error not working in IIS5

Hi, I've made a custom 404 error page in my codebase and have the following lines in the web.config to direct the customer to this page in the event of a 404. <httpErrors errorMode="Custom"> <remove statusCode="404" subStatusCode="-1"/> <error statusCode="404" prefixLanguageFilePath="" path="pgeNotFound.html" responseMode="File"/> ...

How can I save to my web config without losing my session?

I thought about saving all sessions variables to hiddens and then resaving those values back into session after I changed the web config..but there has GOT to be another way. Any help? ...

ASP.net externalize settings from web.config

Hello I have web application and and DB connection settings are stored in web.config The problem is that this application is deployed to multiple servers and connection string may vary. So I would like to have the same web.config on all server and actual configuration settings be externalized, for example to XXX.properties - this is pr...

web.config urlmapping

Hi I have a comment form on my website on contact.aspx. I want to be able to put up a redirect from /comment (no extension) to point to contact.aspx. I set up the following url mapping in my web.config and when I test locally it works fine. When I post it to production, the redirect doesn't happen and I get the IIS 404 error. <system.w...

Web Deployment Project error "It is an error to use a section registered as allowDefinition='MachineToApplication' beyond application level."

Ok, Here's the skinny I have a smallish Visual Studio 2008 web application that I'm attempting to set up a Web Deployment Project with. If I skip attempting to build the Deployment Project, the application builds successfully. If I build the Deployment Project, I get the following error: Error 208: It is an error to use a secti...

Regular Expression on web.config location path attribute (with parameters)

Is there any way of doing something like this? <location path="/(view|edit)post.aspx\?id=[7-9][0-9]+"> <system.web> <authorization> <allow roles="AdminPublishers"/> <deny users="*"/> </authorization> </system.web> </location> Authorization is just an example. I would like to be able to do other thin...

Adding web service bindings into SharePoint web.config using SPWebConfigModification

This is a solution rather than a question actually. The problem was: I had a SharePoint web part which used a WCF service. To consume the web service in my web part, I needed to modify the SharePoint web.config to include bindings and end points. To be able to do this, I put my web service configuration into a text file as a template. T...

Programmatically change System.Web under location

Hi everyone. I am trying to add a way into our own built cms system a way to programmatically update impersonation rules in the web.config. In essence this is pretty easy and know how to do it, however (hence the question) I am trying to edit an impersonation rule in a system.web section inside a <location /> section <location allowOver...

Publish ASPX to sub directory of application [Cannot Load Type]

Hello, I have published an asp.net application to a sub directory of my IIS application. I know that the web.config must exist at the root for several of the properties to work. So I have moved my web.config to the root of the application. I get the following error: Could not load type 'ProjectName.myTypeName'. I suspect that not hav...

Problem Configuring "Location" Path Security on Machine.config

I'm trying to add something like this in Machine.config: <location path="elmah.axd"> <system.web> <authorization> <allow users="domain\johnny" /> <deny users="*"/> </authorization> </system.web> </location> This works great in the application-level web.config, but I can't get it to take ...

Thoughts on how to refer to web.config key names in code

When your web.config or app.config file has an appsettings entry, what is the best way to refer to its key in your code file? Developers I have worked with have differing opinions on this. Some say to hard code the string and others suggest that there should be a file containing string constants and in your code, you use the constant a...

WCF Error - Could not find a base address that matches scheme...

I'm trying to get a WCF web service to work with SSL, as you can imagine it works on my machine, however when I run it on the production environments I get this instead: Could not find a base address that matches scheme http for the endpoint with binding BasicHttpBinding. Registered base address schemes are [https]. Despite many h...

Escape quote in web.config connection string

I have a connection string in my web config: <add name="MyConString" connectionString="Server=dbsrv;User ID=myDbUser;Password=somepass"word" providerName="System.Data.SqlClient" /> As you see, there is a quotation sign ( " ) in the password (given from other dept. I can't change this db users password). How do I have to escape the qu...

DPAPI mixing password and configurable setting in web.config

Hi, I am developing a website and has some password that need to be stored in web.config. I intend to store it in app.settings. However, base on what I understand, if I use DPAPI to secure the data, the entire app.settings section is encrypted. This means that it is not possible for me to mix configuration information like number of row...

Adding custom error pages to a website.

I have a website that makes use of a web.config. I tried adding in the following code: <customErrors mode="On" defaultRedirect="error.htm"> <error statusCode="404" redirect="FileNotFound.htm" /> </customErrors> But it doesn't seem to work. Errors still show up. Could I be putting it in the wrong place? Sample: <authentic...

ASP.NET Custom Errors vs. Compilation debug="false" and security

I keep reading that an ASP.NET based web site should have custom errors enabled in the web.config because exceptions will show a stack trace. I may have a faulty memory (currently don't have access to an ASP.NET website under development), but I thought as long as Compilation debug="false" in the web.config file, then the stack trace wi...

Web.Config values to be specific to release vs debug

Is it possible to make some values in my Web.Config file dependent on whether I am building a release or debug based ASP.NET application? ...