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

  • SEARCH
  • Home
  • 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 302743
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T07:07:31+00:00 2026-05-12T07:07:31+00:00

In IIS7 I am trying to set a really far future expires header for

  • 0

In IIS7 I am trying to set a really far future expires header for all content that have the file name that has a specific word in it. For example I would like to set this header on any file being requested from IIS7 that is

*cached*.js

I know that it is possible to set far future expires headers, But I want to know if it is possible to set it on specific files like in the example above.

I want to use this method on a .NET application I am trying to serve up, but I want to make it more efficient so that certain files will be cached for a very long time, because it virtually never changes. At the same time I don’t want to be restricted to doing it for all files in a certain folder or all files of certain type.

I am open to doing this through modifying my Asp.Net application to achieve this, or through IIS7 settings.

So guys, what do you think, is There a way to do this?

  • 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-05-12T07:07:31+00:00Added an answer on May 12, 2026 at 7:07 am

    An HttpModule will let you do this. That would let you look at the incoming URL then add the correct response headers.

    Edit: Added Example

    You can use this URL to create a basic HttpModule. Then in the Application_BeginRequest event, I think this code will be close to what you want:

    if (context.Request.FilePath.ToLower().IndexOf("cached") != -1)
        context.Response.Cache.SetExpires(DateTime.Now.AddYears(1));
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to write a log file from an ASP.NET application under IIS7, but
I'm trying to write a log file from an ASP.NET application under IIS7, but
Has anyone encountered the following problem: I have IIS7 running on my computer. On
I am trying to set up IIS7 so the a URL with the pattern:
I am using shared hosting with IIS7 and support for PHP. I am trying
I've got IIS7 installed and have a simple website at: c:/inetpub/wwwroot/testsite I can copy
I have a web site running via IIS7 on Vista. The site is running
I have a Windows 2008 Server with IIS7 on it and a web page
I am trying to build a webservice that manipulates http requests POST and GET.
I am trying to set up a streaming WCF service using basicHttpBinding. The service

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.