ASP.NET 4.X Web Forms - Taritsyn/WebMarkupMin GitHub Wiki
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:
-
MinifiedHtmlPage
. Supports HTML minification only. -
MinifiedXhtmlPage
. Supports XHTML minification only. -
CompressedPage
. Supports HTTP compression only. -
MinifiedAndCompressedHtmlPage
. Supports HTML minification and HTTP compression. -
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:
-
MinifiedHtmlMasterPage
. Supports HTML minification only. -
MinifiedXhtmlMasterPage
. Supports XHTML minification only. -
CompressedMasterPage
. Supports HTTP compression only. -
MinifiedAndCompressedHtmlMasterPage
. Supports HTML minification and HTTP compression. -
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.