Skip to content

ASP.NET 4.X Web Forms

dron edited this page Oct 16, 2018 · 1 revision

WebMarkupMin.AspNet4.WebForms package is suitable for use in web applications written in ASP.NET Web Forms version 4.X.

WebMarkupMin.AspNet4.WebForms contains 5 classes of Web Forms pages:

  1. MinifiedHtmlPage. Supports HTML minification only.
  2. MinifiedXhtmlPage. Supports XHTML minification only.
  3. CompressedPage. Supports HTTP compression only.
  4. MinifiedAndCompressedHtmlPage. Supports HTML minification and HTTP compression.
  5. MinifiedAndCompressedXhtmlPage. Supports XHTML minification and HTTP compression.

Below is an example of usage one of these classes:

using System;using WebMarkupMin.AspNet4.WebForms;

namespace WebMarkupMin.Sample.AspNet45.WebForms
{
    public partial class ChangeLog : MinifiedAndCompressedHtmlPage
    {}
}

To disable the markup minification and HTTP compression for a specific page, you can use the DisableMinification and DisableCompression page properties:

protected void Page_PreLoad(object sender, EventArgs e)
{
    DisableMinification = true;
    DisableCompression = true;
}

Result of the markup minification and HTTP compression is recommended to cache by using the OutputCache directive:

<%@ Page Title="Change log" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true"
    CodeBehind="ChangeLog.aspx.cs" Inherits="WebMarkupMin.Sample.AspNet45.WebForms.ChangeLog" %>
<%@ OutputCache CacheProfile="CacheCompressedContent5Minutes" %>
…

Also in the WebMarkupMin.AspNet4.WebForms package have similar classes for master pages:

  1. MinifiedHtmlMasterPage. Supports HTML minification only.
  2. MinifiedXhtmlMasterPage. Supports XHTML minification only.
  3. CompressedMasterPage. Supports HTTP compression only.
  4. MinifiedAndCompressedHtmlMasterPage. Supports HTML minification and HTTP compression.
  5. MinifiedAndCompressedXhtmlMasterPage. Supports XHTML minification and HTTP compression.

Below is an example of usage one of these classes:

using System;using WebMarkupMin.AspNet4.WebForms;

namespace WebMarkupMin.Sample.AspNet45.WebForms
{
    public partial class Site : MinifiedAndCompressedHtmlMasterPage
    {}
}

Сlasses of the Web Forms pages and master pages cannot be used together.