Solved

Show content based on day & time

Posted on 2012-03-21
2
191 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
[X]
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
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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

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…
User art_snob (http://www.experts-exchange.com/M_6114203.html) encountered strange behavior of Android Web browser on his Mobile Web site. It took a while to find the true cause. It happens so, that the Android Web browser (at least up to OS ver. 2.…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
Suggested Courses

623 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