.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
david stephan
Gaurav Pal
Post New Web Links

HTTP Handler IIS Compression

Posted By:      Posted Date: September 16, 2010    Points: 0   Category :ASP.Net
I am using a IHttpHandler to write a PDF file to the output stream in IIS 7 with ASP.NET 4 RC as follows.context.Response.WriteFile(pdfFilePath) context.Response.Flush() I am aware that IIS 7 offers both static and dynamic compression which is configured using the urlCompression and httpCompression elements in their respective config files. This works well except for with the output of IHttpHandlers. It seems their output is not being compressed even though I have enabled dynamic compression and added the IHttpHandler's mime-types (application/pdf in this case) to the dynamicTypes section.Why are my IHttpHandler's output not being compressed by IIS? I'm aware I could do this manually in the handler but I'd rather let IIS do it.Thanks,Eric

View Complete Post

More Related Resource Links

Attempting to use an HTTP handler to display pictures in gridview. It's not working, please help.

I am writing a web page that needs pictures displayed for each item.  The page works just fine except for the pictures.  I have a file called handler.ashx uploaded to the server as well.  It does not seem to be hurting anything, but it doesn't seem to help display the pictures either!  I am working with a MySQL database so I am thinking that the call for the data or the ashx page's structure itself are my problem.  I am using C# Express so there is no generic handler class to autoload and therefore my handler page is pasted together and I know the using statements are in the wrong place, but I'm new to this and I'm lost!  The following is my database table info (table is named: Yamaha), my handler.ashx page code, and the code for the final web page.  I have loaded ".jpeg" or "jpeg" into the field I added called "Image_Type"  since I have already uploaded all pictures as longblobs.  You can view the final web page here: http://www.88867honda.com/YamahaPtsSale.aspx Thanks in advance for any help, Melissa   Table info: Field TypeAttributes--> Null DefaultExtra--> Comments part_number varchar(15)  --> No     -->   description varchar(50)  --> Yes  NULL   -->   qty int(4)  --> Yes  NULL  

Best Way to Enable HTTP Compression

I'm trying to improve the performance of my site using HTTP compression (GZIP or Default) but I'm having trouble finding the information I'm after.My requirements are that I can't use IIS direct (my site uses shared hosting) and I don't want to use a 3rd party tool (my understanding is that it's not necessary). I'd prefer a web.config solution, if there is one.I've been searching for a while. Most solutions I found are very old, some require direct access to IIS, and others require 3rd party tools. I found one that looked promising at http://www.stardeveloper.com/articles/display.html?article=2007110401&page=1, but while it worked under Visual Studio it complains about app.Context.CurrentHandler being null when deployed on my site.As I understand it, there's very little reason not to use compression but I'm having trouble finding current information.Anyone else having better luck with this?Thanks.

HTTP Handler ProcessRequest only Fires First Time


I have a JavaScript method which is called whenever a modal window closes. The JavaScript method calls an HTTP Handler to run a server side function. When I close the window the first time, the code behind runs. When I close it a second time, I can see the JavaScript method run, I am getting an XMLHTTPRequest object, but the code behind does not run again. What am I missing? Thanks.


            function createXMLHttpRequest() {
                try { return new XMLHttpRequest(); } catch (e) { }
                try { return new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { }
                try { return new ActiveXObject("Microsoft.XMLHTTP"); } catch (e) { }
                return null;

            function ClearDocumentSession() {

                var xmlHttpReq = createXMLHttpRequest();
                xmlHttpReq.open("GET", "http://localhost:56331/Handlers/AjaxHandler.ashx", false);


The handle

public class AjaxHandler : IHttpHandler, IRequiresSessionState

        public void ProcessRequest(HttpContext context)
           //  context.Response.ContentType = "text/html";

IIS 7.5 - HTTP Error 404.17 - Not Found - Static File Handler.


 I'm having an issue with web.config file in my development environment. I had the WCF site running on my local. My local has VS2010 framework 4.0 installed. I published the code and hosted the site in IIS 7.5 2008 R2 on my dev server which has an application pool of framework 2.0. I had an issue which says

HTTP Error 404.17 - Not Found

The requested content appears to be script and will not be served by the static file handler.


These are the few handlers that i've in my web.config file on my dev server. There are other handlers too which are inherited.


      <add name="ScriptHandlerFactory" verb="*" path="*.asmx" preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
      <add name="ScriptHandlerFactoryAppServices" verb="*" path="*_AppService.axd" preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />

Has Anyone Got HTTP Compression Working?


I've spent quite a bit of time on this but seem to be going nowhere. I have a large page that I really want to speed up. The obvious place to start seems to be HTTP compression, but I just can't seem to get it to work for me.

After considerable searching, I've tried several variations of the code below. It kind of works, but after refreshing the browser, the results seem to fall apart. They were turning to garbage when the page used caching. If I turn off caching, then the page seems right but I lose my CSS formatting (from a separate file) and get an error that an included JS file contains invalid characters.

Most of the resources I've found on the Web were either very old or focused on accessing IIS directly. My page is running on a shared hosting account and I do not have direct access to IIS7, which it's running on.

protected void Application_BeginRequest(object sender, EventArgs e)
    // Implement HTTP compression
    if (Request["HTTP_X_MICROSOFTAJAX"] == null)    // Avoid compressing AJAX calls
        // Retrieve accepted encodings
        string encodings = Request.Headers.Get("Accept-Encoding");
        if (encodings != null)
            // Check the b

HTTP Handler Problem


<img alt="httpHandler" src="getImage.ashx?id=1">

works fine

<asp:Label ID="sd" Text='<%# "getText.ashx" %>' runat="server"></asp:Label>

i have written httphandler which will display text of a label but processrequets of httphandler event is not being fired.

any help plese.

Files won't download from ASP.NET site when the site has a custom HTTP Handler mapped to the file e


When I have a HttpHandler class in C#/ASP.NET mapped to a file extension in IIS any file with that extension fails to download/display in web browsers (it's downloaded as a 0-byte file in some browsers and nothing at all in other browsers).  After removing the application mapping for the HttpHandler in IIS so it doesn't call the IHttpHandler class in C#, the web browser downloads the file successfully.

This was tested with an IHttpHandler class in C# that has an empty ProcessRequest method. Any ideas on what the problem could be?

Response Content Type can not be set within Http Handler


as the subject, i have a handler that process all kind of request to the server (path="*"),

whenever i try to set the content type, it will be overridden by a default value "text/html",

i am using IIS7 + Framework 4  in integrated mode, any idea?

When to use HTTP-Handler ?


Hi Guys,

Can you please explain me when to use HTTP Handlers ? What scenarios we may need HTTP Handlers ?

Thanks in advance.

ASP.NET Architecture - ASP.NET Worker Process - HTTP Pipleline - Http Modules and Handlers

"ASP.NET is a powerful platform for building Web applications, that provides a tremendous amount of flexibility and power for building just about any kind of Web application. Most people are familiar only with the high level frameworks like WebForms and WebServices which sit at the very top level of the ASP.NET hierarchy. In this article I'll describe the lower level aspects of ASP.NET and explain how requests move from Web Server to the ASP.NET runtime and then through the ASP.NET Http Pipeline to process requests.

Open File Print File Excel

Batch print many Excel files without having to open each one at a time. Quickly print mass amounts of xls files at once with this program. You must have Excel installed on your machine..

Writing Http Handlers and Modules in IIS 7.5

This article describes how Http modules and handlers are to be written and configured in IIS 7.5. The concept of a handler and module remains same, so dose there programming model. In this section we start off with the concept of a Http module and a Http handler, then talk about how to code them and finally describe the two methods available to configure them.

HTTP Error 403 - Forbidden


(VB Express website directed me to ASP.NET Web Services which in turn redirected me to this forum).

 Hopefully someone can help me here...... 

I am using VIsual Web Developer and downloaded the small business application to use as a starting point to help my wife get a website up for her small business. When I load the application, I can F5 and it runs fine but as soon as I make any modification to the app and hit F5, I get the HTTP Error 403 - Forbidden when it tries to show the website.

I notice a pop up that occurs when I run that allows me to choose the link for my app and it displays correctly (I close the webpage that has the error on it).

This seems like a pain, is there a setting I'm missing - I would think that this should "just work".

What's up?????



http/localhost is empty


I have Win , I install the following

in Internet Information Service->

Web Management Tools (check)

Application Development Features I check (.Net Extensibility, ASP.net, ISAPIExtensions, ISAPIFilterd,  I can see  IIS Manager under my Administrative tool , but when I call


I  can't see the welcome page , what is wrong

thank you!

I am not able to read xml file with XDocument if its Descendants has Attribute xmlns="http://abc.co


I am not able to read xml file with XDocument if its Descendants has  Attribute like:-

<?xml version="1.0" encoding="utf-8" standalone="yes"?>
  <row ID="1" xmlns="http://www.opentravela.org/OTA/2003/05">
    <var country_name="Caribbean and Rest of the world" city_name="Kingston" flight_category="Economy Class" via="Atlanta" flight_departure="London Heathrow" airline_logo="Delta" adult_fare="Delta" child_fare="660" infant_fare="561" date1="132" date2="2010-08-15" />


I don't know what to do ?

Looking for some help..

HTTP Post and WebService


I am working on a application which will accept the data in the post request. My application also wants to expose a web service and want to call another web service. Considering all these 3 action that I want to do, can I create a single application which will have a web form which will accept the POST request and expose a web service at the same time.

Although it may be possible to achieve this, Is this a correct way of doing it?

ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend