ProTech's home page

ProTech-Online.com

Microsoft C# ASPX code example http output filter.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Security.Principal;
using System.Diagnostics;
using System.Web.Security;
/// <summary>
/// Summary description for OutputFiler
/// </summary>
public class SANSOutputFiler : IHttpModule
{
    private HttpApplication httpApp;
    public void Init(HttpApplication httpApp)
    {
        this.httpApp = httpApp;
        httpApp.ReleaseRequestState += new EventHandler(OnReleaseRequestState);
    }
    void OnReleaseRequestState(object sender, EventArgs a)
    {
        try
        {
            HttpResponse response = (HttpResponse) httpApp.Context.Response;
            if (response.ContentType == "text/html")
                response.Filter = new SANSReplaceHTML(response.Filter);
        }
        catch (Exception ex)
        {
            string test = ex.Message;
        }
    }
    public void Dispose()
    { }
}


Copyright © 2013 ProTechs-Online.com; All rights reserved.