Ask Learn
Preview
Please sign in to use this experience.
Sign inThis browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Provides a way to create a strongly typed reference to the ASP.NET master page when the master page is accessed from the Master property.
<%@ MasterType attribute="value" [attribute="value"...] %>
TypeName
Specifies the type name for the master page.
VirtualPath
Specifies the path to the file that generates the strong type.
Use the @ MasterType directive to set the strong type for the master page, as accessed through the Master property.
Note
if VirtualPath is not defined, the type must exist in one of the currently linked assemblies, such as App_Bin or App_Code.
If both attributes, TypeName and VirtualPath, are defined, the @ MasterType directive will fail.
The following code example demonstrates how to set the virtual path to an ASP.NET master page.
<%@ MasterType VirtualPath="~/masters/SourcePage.master"" %>
Please sign in to use this experience.
Sign in