How to configure static content cache per folder and extension in IIS7?

You can set specific cache-headers for a whole folder in either your root web.config: <?xml version=”1.0″ encoding=”UTF-8″?> <configuration> <!– Note the use of the ‘location’ tag to specify which folder this applies to–> <location path=”images”> <system.webServer> <staticContent> <clientCache cacheControlMode=”UseMaxAge” cacheControlMaxAge=”00:00:15″ /> </staticContent> </system.webServer> </location> </configuration> Or you can specify these in a web.config file in … Read more

Meaning

Modules Preconditions: The IIS core engine uses preconditions to determine when to enable a particular module. Performance reasons, for example, might determine that you only want to execute managed modules for requests that also go to a managed handler. The precondition in the following example (precondition=”managedHandler”) only enables the forms authentication module for requests that … Read more

asp.net core web api published in IIS after moved to different IIS server pc gives error 500.19 (0x8007000d)

To get a more detailed error message: Verify that the log directory exists at the path referenced by the web config. If it does not, create it. The path shown in your config would place the “logs” directory in the root folder of the deployed site. Verify that the application pool has write access to … Read more

How do you modify the web.config appSettings at runtime?

You need to use WebConfigurationManager.OpenWebConfiguration(): For Example: Dim myConfiguration As Configuration = System.Web.Configuration.WebConfigurationManager.OpenWebConfiguration(“~”) myConfiguration.ConnectionStrings.ConnectionStrings(“myDatabaseName”).ConnectionString = txtConnectionString.Text myConfiguration.AppSettings.Settings.Item(“myKey”).Value = txtmyKey.Text myConfiguration.Save() I think you might also need to set AllowLocation in machine.config. This is a boolean value that indicates whether individual pages can be configured using the element. If the “allowLocation” is false, it cannot be … Read more

Using different Web.config in development and production environment

In Visual Studio 2010 and above, you now have the ability to apply a transformation to your web.config depending on the build configuration. When creating a web.config, you can expand the file in the solution explorer, and you will see two files: Web.Debug.Config Web.Release.Config They contain transformation code that can be used to Change the … Read more