English 中文(简体)
How to find if a request is for js or css in httpHandler
原标题:

is there any way to find if a particular request is for JS or CSS in httphandler

to improve the performance of my website i was using HttpCompress from Code Project http://www.codeproject.com/KB/aspnet/httpcompression.aspx?msg=2544100

but since it is combining all the js it is breaking my javascript in many places...so i want to write a httphandler so that iwould be able to serve the js and css compressed.( i have already minified them using YUICompressor). i know this will cause multiple http request but in my case i have a deadline and so dont want combining of javascripts and css.

so any approach to do so???????

also i have seen in the source codes of compression module that they check if the file is already on the browser and send a 304 Not Modified response header but it is a little confusing to me so can anyone break it down as to how to proceed if i want to do the same....

i do not want whole answer just simple pointers would do...

thanks a lot

P.S i am on shared hosting and do not have access to IIS

最佳回答

In the example config file for HttpCompress they give two options for excluding files from being compressed: Exclusion by MIME type and Exclusion by path.

The following config file presumes that your server is serving javascript as text/javascript (something you should double check before setting).

<DCWeb>
<HttpCompress  compressionType="GZip">

  <IncludedMimeTypes>
    <add mime="text/html" />
  </IncludedMimeTypes>


  <ExcludedMimeTypes>
    <add mime="text/javascript" />
  </ExcludedMimeTypes>

   <ExcludedPaths>
     <add path="~/PathToYourJavascriptFiles/" />
   </ExcludedPaths>

  </HttpCompress>
 </DCWeb>
问题回答

暂无回答




相关问题
BlackBerry - Unpack Zip File

I m developing a BlackBerry application in which I need to unpack a zip file compressed with PKZIP. The package could have one file in it, or it could have 10; it will vary in each case. I know that ...

How to find if a request is for js or css in httpHandler

is there any way to find if a particular request is for JS or CSS in httphandler to improve the performance of my website i was using HttpCompress from Code Project http://www.codeproject.com/KB/...

Compress data before storage on Google App Engine

I im trying to store 30 second user mp3 recordings as Blobs in my app engine data store. However, in order to enable this feature (App Engine has a 1MB limit per upload) and to keep the costs down I ...

How to process compressed data in Java

I have some data which takes up more than 50MB in an uncompressed file, but compresses down to less than half a MB using gzip. Most of this is numerical data. I m trying to figure out how to process ...

What is the best way to extract a zip file using java

I have a a zipped file. That file contains various directories and files also. I want to extract all those and save in a specified path. So How to write a java program to extract the zipped file. ...

热门标签