[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

how do i specify master page programtically under asp.net mvc 4

Posted on 2014-12-30
1
Medium Priority
?
145 Views
Last Modified: 2015-01-01
how do i specify the master page programtically,for example,i'd like main page goes to a out of service from 8:00 pm to 8:00am,& set a filter out of service  from 8:00 pm to 8:00am as well.in addtion ,i have a ip database api,i'd like restrict the ip only from my country to access,otherwise the main page goest to "bad request" page.how do i do this programtically?
many thanks & best regards
ken
0
Comment
Question by:ken yup
[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
1 Comment
 
LVL 25

Accepted Solution

by:
apeter earned 2000 total points
ID: 40525177
You can check below 2 conditions in one place.

1. Timing
2. Ip from ips database

put this code block in the Application_BeginRequest of the Global.asax

void Application_BeginRequest(object sender, EventArgs e)
      {
          if (DateTime.Now <is greater than 8 am and lesser than 8 pm>) AND (Request.UserHostAddress <is in your ip datadatabase>)) //replace the <text> to a c sharp syntax
          {
              if (!Request.IsLocal)
              {
                  HttpContext.Current.RewritePath("<Your Maintenance Page >");
              }
          }
      }
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

Article by: Ivo
C# And Nullable Types Since 2.0 C# has Nullable(T) Generic Structure. The idea behind is to allow value type objects to have null values just like reference types have. This concerns scenarios where not all data sources have values (like a databa…
Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
Suggested Courses

656 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