Solved

Show content based on day & time

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

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

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

Suggested Solutions

Lots of people ask this question on how to extend the “MembershipProvider” to make use of custom authentication like using existing database or make use of some other way of authentication. Many blogs show you how to extend the membership provider c…
In this Article, I will provide a few tips in problem and solution manner. Opening an ASPX page in Visual studio 2003 is very slow. To make it fast, please do follow below steps:   Open the Solution/Project. Right click the ASPX file to b…
This is used to tweak the memory usage for your computer, it is used for servers more so than workstations but just be careful editing registry settings as it may cause irreversible results. I hold no responsibility for anything you do to the regist…
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…

815 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

11 Experts available now in Live!

Get 1:1 Help Now