Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Show content based on day & time

Posted on 2012-03-21
2
187 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

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I recently went through the process of creating a Calendar Control of events with the basis of using a database to keep track of the dates that are selectable, one requirement was to have the selected date pop-up in a simple lightbox.  At first this…
In .NET 2.0, Microsoft introduced the Web Site.  This was the default way to create a web Project in Visual Studio 2005.  In Visual Studio 2008, the Web Application has been restored as the default web Project in Visual Studio/.NET 3.x The Web Si…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

829 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