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 8080851
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T16:32:33+00:00 2026-06-05T16:32:33+00:00

I have an expiry date in my database and I would like to redirect

  • 0

I have an expiry date in my database and I would like to redirect a web page when the expiry date for that page has been reached.

How would I do this?

Thanks

  • 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-05T16:32:34+00:00Added an answer on June 5, 2026 at 4:32 pm

    You can do that using a cache for your pages. I’m obviously not familiar how you store the expire dates, but I’ll presume you have [exp_date: url].

    So:

    protected void Application_Start(object sender, EventArgs e)
    {
    Dictionary<Datetime, string> pages = Read_from_database();
    Context.Cache.Insert("ExpireCache", pages, new CacheDependency(m_strPath),
        System.Web.Caching.Cache.NoAbsoluteExpiration, System.Web.Caching.Cache.NoSlidingExpiration,
        CacheItemPriority.Default);
    }
    

    And in

    protected void Application_BeginRequest(object sender, EventArgs e)
    {
        if (HttpContext.Current.Request.Url.AbsolutePath == "page_expired.aspx")
        {
            return;
        }
        var cache = HttpContext.Current.Cache["ExpireCache"];
        if (cache.ContainsKey(HttpContext.Current.Request.RawUrl) &&
            cache[HttpContext.Current.Request.Url.AbsolutePath] < DateTime.Now)
        {
            HttpContext.Response.Current.Redirect("page_expired.aspx");
        }
    }
    

    You can additionally add a SqlDbDependency to the Cache, so that it get updated when you modify the expire dates in the Database…

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this as expiry date $expiryDate = new DateTime(); But that puts expiry
I'm pulling my hair out over this one - I have a page that
In a SQL Server 2005 database, I have lots of tables like this Products
I have a line of code that sets a cookie with an expiry date
I have the date 2010-11-24 and this date expires in 3 years. The expiry
I'm busy coding a website with adverts that have an expiry date. After the
I have an ASPX page that makes a lot of database queries that I
I have have this query that i want to execute. SELECT warehouse.expiry_date, pharmacy.expiry_date, drugs.active_substance,
HI I have an example document that looks like <ItemEntry> <PurchaseDate>2010-03-18T20:36:32.81108+13:00</PurchaseDate> <StoreGUID>0a0324ad-5f99-486a-a2d0-870bc6991e9f</StoreGUID> <ExpiryDate />
I have a table in a Oracle database containing a date field EXPIRYDATE. I

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.