Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8637315
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T10:26:58+00:00 2026-06-12T10:26:58+00:00

I have ASP.NET web service project. I must switch off (return void or null)

  • 0

I have ASP.NET web service project. I must “switch off” (return void or null) the all methods in this service if current time is between 00:00 and 01:00. What is the best way to do it? may be global.asax file?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T10:27:00+00:00Added an answer on June 12, 2026 at 10:27 am

    You can do that on Global.asax, on Application_BeginRequest, just check if is a webservice and then if not allow that hours you just cut it.

    protected void Application_BeginRequest(Object sender, EventArgs e)
    {
       string cTheFile = HttpContext.Current.Request.Path;
       string sExtentionOfThisFile = System.IO.Path.GetExtension(cTheFile);
       // here you can check what file you wish to cut, ether by file, ether by extention
       if (sExtentionOfThisFile.Equals(".asmx", StringComparison.InvariantCultureIgnoreCase))
       {
         // and here is the time limit.
         if(DateTime.UtcNow.Hour >= 0 && DateTime.UtcNow.Hour <= 1)
         {
            HttpContext.Current.Response.TrySkipIisCustomErrors = true;
            HttpContext.Current.Response.StatusCode = 403;
            HttpContext.Current.Response.End();
            return ;    
        }    
      }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an asp.net web service project. This project contains a few classes declared
I have a data table in my ASP.NET web service project, this data table
Interesting one here. I have an ASP.NET 1.1 project that contains a web service
I have a ASP.NET web service decorated with System.Web.Script.Services.ScriptService() so it can return json
I have created a new VS2008 ASP.Net Web service project, with the default name
The project is an Asp.Net Web API web service. I have a type hierarchy
All, I have a ASP.NET Web API project that is making a REST call
I have an ASP.NET (.asmx) Web Service project that has a method like: public
I have a C# ASP.NET web service running (successfully) on this PC. I can
I use asp.net and web forms. In my project I have asmx web service

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.