Validation <validation>
Overview
The <validation>
element configures Internet Information Services (IIS) 7 to detect whether an ASP.NET application that is set up to run in Classic .NET mode needs to be changed in order to function correctly in Integrated mode.
IIS generates a migration error message if the validateIntegratedModeConfiguration attribute is set to true and one of the following is also true:
Your application defines an
<httpModules>
section in its Web.config file.In IIS 7 Integrated mode, ASP.NET modules are specified with native modules in a unified <modules> section under <system.webServer>.
Your application defines an
<httpHandlers>
section in its Web.config file.In IIS 7 Integrated mode, the ASP.NET handler mappings are specified in a unified <handlers> section inside <system.webServer>. The <handlers> section replaces both the ASP.NET
<httpHandlers>
and IIS script-processor-mapping configurations, which were both required to set up an ASP.NET 1.0 handler mapping.Your application's Web.config file specifies
<identity impersonate="true" />
.In IIS 7 Integrated mode, client impersonation is not available in some early request processing stages. Therefore, IIS will generate the migration error message. If your ASP.NET Web application impersonates client credentials (most common with intranet scenarios), you may want to set the validateIntegratedModeConfiguration attribute to false.
Note
If you migrate your configuration manually, or you do not migrate your configuration but you want IIS to remain in Integrated mode (which is not advised), you can disable migration error messages by setting the validateIntegratedModeConfiguration attribute to false. Because IIS will no longer provide warnings for unsupported configurations when validateIntegratedModeConfiguration is false, ensure that your application works correctly in Integrated mode before you make this setting.
Compatibility
Version | Notes |
---|---|
IIS 10.0 | The <validation> element was not modified in IIS 10.0. |
IIS 8.5 | The <validation> element was not modified in IIS 8.5. |
IIS 8.0 | The <validation> element was not modified in IIS 8.0. |
IIS 7.5 | The <validation> element was not modified in IIS 7.5. |
IIS 7.0 | The <validation> element was introduced in IIS 7.0. |
IIS 6.0 | N/A |
Setup
The <validation>
element is included in the default installation of IIS 7.
How To
There is no user interface for adding validation for IIS 7. For examples of how to add validation programmatically, see the Code Samples section of this document.
Configuration
Attributes
Attribute | Description |
---|---|
validateIntegratedModeConfiguration |
Optional Boolean attribute. Specifies whether configuration validation is enabled when it runs in Integrated mode. The <system.Web/httpHandlers> and <system.Web/httpModules> sections as well as impersonation are checked during this process.The default value is true . |
Child Elements
None.
Configuration Sample
The following configuration sample enables validation. > [!NOTE]
This excerpt is from a Web.config file, so this configuration sample can be used at any folder level within a Web site.
<configuration>
<system.webServer>
<validation validateIntegratedModeConfiguration="true" />
</system.webServer>
</configuration>
Sample Code
The following code samples enable validation for the Default Web Site.
AppCmd.exe
appcmd.exe set config "Default Web Site" -section:system.webServer/validation /validateIntegratedModeConfiguration:"True"
C#
using System;
using System.Text;
using Microsoft.Web.Administration;
internal static class Sample
{
private static void Main()
{
using(ServerManager serverManager = new ServerManager())
{
Configuration config = serverManager.GetWebConfiguration("Default Web Site");
ConfigurationSection validationSection = config.GetSection("system.webServer/validation");
validationSection["validateIntegratedModeConfiguration"] = true;
serverManager.CommitChanges();
}
}
}
VB.NET
Imports System
Imports System.Text
Imports Microsoft.Web.Administration
Module Sample
Sub Main()
Dim serverManager As ServerManager = New ServerManager
Dim config As Configuration = serverManager.GetWebConfiguration("Default Web Site")
Dim validationSection As ConfigurationSection = config.GetSection("system.webServer/validation")
validationSection("validateIntegratedModeConfiguration") = True
serverManager.CommitChanges()
End Sub
End Module
JavaScript
var adminManager = new ActiveXObject('Microsoft.ApplicationHost.WritableAdminManager');
adminManager.CommitPath = "MACHINE/WEBROOT/APPHOST/Default Web Site";
var validationSection = adminManager.GetAdminSection("system.webServer/validation", "MACHINE/WEBROOT/APPHOST/Default Web Site");
validationSection.Properties.Item("validateIntegratedModeConfiguration").Value = true;
adminManager.CommitChanges();
VBScript
Set adminManager = WScript.CreateObject("Microsoft.ApplicationHost.WritableAdminManager")
adminManager.CommitPath = "MACHINE/WEBROOT/APPHOST/Default Web Site"
Set validationSection = adminManager.GetAdminSection("system.webServer/validation", "MACHINE/WEBROOT/APPHOST/Default Web Site")
validationSection.Properties.Item("validateIntegratedModeConfiguration").Value = True
adminManager.CommitChanges()