Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8663899
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T17:06:22+00:00 2026-06-12T17:06:22+00:00

I am running into some problem, I created a type that I am using

  • 0

I am running into some problem, I created a type that I am using as a HTTPHandler for aspx in my web.config file, the code..

<add path="*.aspx" verb="*" type="myHandler"></add>

The cs page is

public class myHandler :  IHttpHandler
{
    public void ProcessRequest(System.Web.HttpContext context) 
    {
        // check if client browser can accept gzip encoding
        string AcceptEncoding = context.Request.Headers["Accept-Encoding"];
        if (!string.IsNullOrEmpty(AcceptEncoding) && AcceptEncoding.Contains("gzip"))
        {
            // if yes, apply it
            context.Response.Filter = new GZipStream(context.Response.Filter, CompressionMode.Compress);
            context.Response.AddHeader("Content-Encoding", "gzip");
        }
        // don't do anything else, just let the default page handling work
    }

    public bool IsReusable
    {
        get { return false; }
    }

}

As you can see, I am checking if the client accepts a gzip encoding, if yes, add it, and let the default process handle…
BUT the response I am getting is..

XML Parsing Error: no element found
Location: http://localhost:49903/Masters/Default.aspx
Line Number 1, Column 1:
^

every single page is returning this error? I am guessing that after I handled the request in my handler, it is somehow clearing everything else or something related.

Firebug shows the following..

Response Headers

Cache-Control   private
Connection  Close
Content-Encoding    gzip
Content-Length  0
Date    Sat, 06 Oct 2012 13:14:50 GMT
Server  ASP.NET Development Server/10.0.0.0
X-AspNet-Version    4.0.30319


Request Headers

Accept  text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Encoding gzip, deflate
Accept-Language en-us,en;q=0.5
Connection  keep-alive
Cookie  ASP.NET_SessionId=1wfoaqta3mosntii1c3ual1i; .ASPXAUTH=D41BBDC2CCF15048BB5A345EBBFBC63EAE35FD37E2F1F170C1D68495477889A989353D4EB30F2B9A723F83C21293A47478B654A1BD2453BCF032DC539427EA0E519D2FEE70DB7660F00AA90E159633C4
Host    localhost:49903
Referer http://localhost:49903/Masters/Default.aspx
User-Agent  Mozilla/5.0 (Windows NT 5.1; rv:15.0) Gecko/20100101 Firefox/15.0.1


Request Headers From Upload Stream

Content-Length  8241
Content-Type    multipart/form-data; boundary=---------------------------2995119424827

So, from what I am guessing, I would like to know is there a way that after I have handled the page my way, I can do something like base.ProcessRequest(). I know its not possible, because I am implementing a interface and not deriving from a class, but I wanna know, how can I let the asp.net engine process the page after am I done with mine?

NB This question is not about implementing gzib encoding, I know I can set it in web config, at each page, in IIS, make a static function in a utility class and call it, and many other things. But again, please don’t answer that I could use a different way to implement this gzip encoding, I know I can, what I am concerned is how can I let asp.net do its default handling (or whatever that may mean) after I am done with my custom handling?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T17:06:24+00:00Added an answer on June 12, 2026 at 5:06 pm

    You follow the wrong path. The handler you try to use is for make a totally different way for processing some kind of files ending in a different extensions, by adding the .aspx then you handle that page and not permit the asp.net processing the pages at all.

    What you should do is to make an httpModule, eg a class like:

    public class gZipModule : IHttpModule
    {
        void IHttpModule.Init(HttpApplication context)
        {
            context.BeginRequest += new EventHandler(context_BeginRequest);
        }
    
        void IHttpModule.Dispose()
        {
        }
    
        private void context_BeginRequest(object sender, EventArgs e)
        {
            // gzip here
        }
    }
    

    and on web config:

    <httpModules>
       <add type="gZipModule"  name="gZipModule" />
    </httpModules>
    

    or even more simple, on global.asax make at Application_BeginRequest the gZip

    protected void Application_BeginRequest(Object sender, EventArgs e)
    {
        // check if the file is .aspx, then make gzip
        string cTheFile = HttpContext.Current.Request.Path;
        string sExtentionOfThisFile = System.IO.Path.GetExtension(cTheFile);
    
        if (sExtentionOfThisFile.Equals(".aspx", StringComparison.InvariantCultureIgnoreCase))
        {   
            // now make gZip
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Trying to truncate some code here and running into a problem: <script type=text/javascript> $(function()
I'm working on writing some automation code and I'm running into a problem finding
I am attempting to compile some code, but am running into some problems that
For some unknown reason I'm running into a problem when passing a variable to
I'm learning and testing some graph libraries and am running into a weird problem(but
I'm running into some problems using my .NET 4.0 libraries in .NET 2.0 applications.
I am running into a problem which I am using C Dll into my
I am working on a custom SSO solution and running into some problems with
I have been trying to learn Erlang and have been running into some problems
I am running into problems where some of our data stores are seeing a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.