You can use device filtering to customize certain rendering aspects of Web server controls depending on the browser or device that accesses them. When a user requests a Web page from a server, the user's browser makes a request that contains information such as the user-agent and other headers that identifies the browser's type and version. ASP.NET can then match the identifier to a particular device defined in a browser file. Output can then be filtered by device by using the identifier in Web server controls.
Device Filtering
The following declarative code example demonstrates use of a device filter to shorten the text property of a
В | Copy Code |
---|---|
<asp:Label runat="server" id="title" Text="Welcome to Our Online Shopping Catalog" PIE:Text="Welcome, Shopper" /> |
Control Filters
You can filter output on controls for different devices by applying filters to:
-
Control properties
-
Custom attributes
-
Templates
Device Filters for Directives
You can also apply device filters to
-
Buffer
-
ClientTarget
-
CodePage
-
ContentType
-
Culture
-
EnableViewState
-
EnableViewStateMac
-
ErrorPage
-
LCID
-
MasterPageFile
-
ResponseEncoding
-
Theme
-
UICulture
If you are working with user controls, you can apply device filters to
Finally, you can apply device filters attributes in the
Note |
---|
You cannot specify a device filter in the Web.config file. |