Web Form is an ASP.NET technology that we use to create a programmable Web page. It can present information, using any markup language, to the user in any browser, and can use code on the server to implement application logic.
Characteristics of Web Forms in ASP.NET:
1. A Web-form of your design can run on a specific browser of your choice, or it can run on any browser and automatically render the browser-compliant HTML.
2. It is built on the Common Language Runtime, thereby providing a managed execution environment, type safety, inheritance, and dynamic compilation. It can be programmed in any CLR-supported language.
3. It supports WYSIWYG editing tools and development tools such as VS.NET.
4. It supports a rich set of controls that enables you to encapsulate page logic into reusable components and declaratively handle page events.
5. It allows for separation between code and content on a page.
6. It provides a set of state management features that preserves the view state of a page between requests.
A Web-form may contain directives, server-side scripts, client-side scripts, static texts, Web controls, HTML controls, etc.
It is used to set various attributes about a page. The ASP Engine and the compiler follow these directives to prepare a page. There are many kinds of directives. Example:
@ Page,@ Import,@Implements, @ Register,@ OutputCache and @ Assembly directives
List of Page Directives and their functions:
@ Page: We may use this directive to declare many page-related attributes about a particular page. Example:
<%@ Page Language=” VB” Debug=” true” %>
There are numerous attributes of this directive. Some of the frequently used ones are these: AutoEventWireup, Buffer, ClientTarget, EnableSessionState, ErrorPage, Debug, Trace, TraceMode, and so on.
@ Import: We use this directive to import a namespace in the page class file. we are importing the System.Data.OleDb namespace in our page: Example:
<%@ Import Namespace=”System.Data.OleDb” %>
@ OutputCache: We can use this directive to specify how to cache the page. Example:
%@ OutputCache Duration=”10” /%>
@ Register: This directive is used to register a custom control in a page. Example: