Share via


add Element for urlMappings (ASP.NET Settings Schema)

Adds the specified UrlMapping object to the collection.

configuration Element (General Settings Schema)
  system.web Element (ASP.NET Settings Schema)
    urlMappings Element (ASP.NET Settings Schema)
      add Element for urlMappings (ASP.NET Settings Schema)

<add url="String" 
     mappedUrl="String"/>

Attributes and Elements

The following sections describe attributes, child elements, and parent elements.

Attributes

Attribute

Description

url

Required String attribute.

Defines the application-relative URL of incoming requests that will be re-mapped to a different URL by the ASP.NET runtime.

mappedURL

Required String attribute.

Defines the application-relative URL that is the target of a mapping.

Note

The mappedUrl must be an application-relative URL. At runtime the mappedUrl is converted to an absolute virtual path based on the root of the currently executing application. The mappedUrl can include query string information. The mappedUrl is trimmed to eliminate any leading or trailing spaces.

Child Elements

None.

Parent Elements

Element

Description

configuration

The required root element in every configuration file used by the common language runtime and .NET Framework applications.

system.web

Specifies the root element for the ASP.NET configuration settings in a configuration file. Contains configuration elements that configure ASP.NET Web applications and control how the applications behave.

urlMappings

Defines the mapping of one URL to another mapped URL.

Example

The following example adds a UrlMapping object to an ASP.NET application.

Note

By design, you cannot map to the same page. If you do, state information is lost in postbacks.

<urlMappings enabled="true">
  <add url="~/Home.aspx" mappedUrl="~/Default.aspx?tab=home" />
</urlMappings>

Element Information

Configuration section handler

System.Web.Configuration.UrlMappingsSection

Configuration member

SystemWebSectionGroup.UrlMappings

UrlMappingsSection.UrlMappings

Configurable locations

Machine.config

Root level Web.config

Application level Web.config

Requirements

IIS version 5.0, IIS version 5.1, or IIS version 6.0

.NET Framework version 2.0

Visual Studio 2005

See Also

Tasks

How to: Configure Specific Directories Using Location Settings

How to: Lock ASP.NET Configuration Settings

Reference

system.web Element (ASP.NET Settings Schema)

configuration Element (General Settings Schema)

clear Element for urlMappings (ASP.NET Settings Schema)

remove Element for urlMappings (ASP.NET Settings Schema)

System.Configuration

System.Web.Configuration

Concepts

ASP.NET Configuration Overview

ASP.NET Configuration Scenarios

Securing ASP.NET Configuration

Other Resources

General Configuration Settings (ASP.NET)

ASP.NET Configuration Settings

ASP.NET Web Site Administration

ASP.NET Configuration API