ASP.NET Web Forms Content

Web forms provide a way for ASP.NET developers to quickly create web pages. This feature is object-oriented and can help you keep your web page generation code easier to maintain and improve. Here we look at common ways to use web forms in the ASP.NET web application framework.

Literal control

You can insert plain text into a website using the asp:Literal markup or the LiteralControl element in C# code. The articles linked here describe how you can use literals in ASP.NET.

See asp:Literal Use.

See LiteralControl Example.

Canonical links (SEO)

If you are using web forms, you can add meta elements to your website fairly easily. One example of this is adding a canonical link element, which can sometimes enhance search performance for sites.

See Canonical Link Element.

HtmlMeta type

The HtmlMeta type enables you to represent a metadata element for HTML inside C# code. You can use the HtmlMeta to add important information to the metadata of your webpages.

See HtmlMeta Example.

Master pages

There is some information about master pages and their usage in this section as well. Master pages are still in wide usage and can help separate the template from the more specific content sections.

See Master Page Use.

See Master Page SEO.

See Master Page Drawbacks.

ID property

It is possible to remove the generated ID attribute from your web form projects in ASP.NET. You can simply set the ID to null to do this. I have been ridiculed for stating that the ID can be removed; please see the article for my evidence.

See Remove ID From Control.

Server-side comments

This is not strictly a web forms feature, but it is a markup feature for IIS pages. Server side comments can be used to remove text from pages before they are sent over the network; this can reduce page sizes.

See Server-Side Comments.

Visible property

The Visible property is one of the more useful ones for using web forms because it enables you to use a template and remove or add elements from it without creating them programmatically. The selected article describes the Visible property in more detail.

See Visible Property.

© 2007-2010 Sam Allen. All rights reserved.

Dot Net Perls  Sam Allen