Solved

Show content based on day & time

Posted on 2012-03-21
2
184 Views
Last Modified: 2012-03-21
Hi Experts

I'm developing a site that needs to only show content every Sunday between 1800 & 2100.

How would I do this?

Andy
0
Comment
Question by:Andy Green
2 Comments
 
LVL 20

Accepted Solution

by:
BuggyCoder earned 500 total points
ID: 37746400
In Global.asax do this:-

void Application_BeginRequest(object sender, EventArgs e)
{
var dateTime = DateTime.Now;
 var hour = dateTime.Hour;
if(!((dateTime.DayOfWeek==DayOfWeek.Sunday) &&(hour>=18 && hour<21)))
{
Server.Transfer("NotWorking.htm");
}
}

Open in new window

0
 
LVL 3

Author Closing Comment

by:Andy Green
ID: 37746428
Thanks, it was thsi I needed: - dateTime.DayOfWeek==DayOfWeek.Sunday

Andy
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

In an ASP.NET application, I faced some technical problems. In this article, I list them out and show the solutions that I found.  I hope it will be useful. Problem: After closing a pop-up window, the parent page should be refreshed automaticall…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now