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

  • SEARCH
  • Home
  • 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 8104967
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T00:02:39+00:00 2026-06-06T00:02:39+00:00

Is there an integrated way in asp.net mvc 3, to permit authentification and actions

  • 0

Is there an integrated way in asp.net mvc 3, to permit authentification and actions based on the time of the day ?
For example, if it’s 18:00 o’clock, users that belong to a specific role are not allowed to log in or if they are already authenticated, they will be automatically logged out or not being able to do actions.

I guess in the log in method I could check for user role and time of day and then on each action, I will also check for role and time of day and permit but is there and easier way to accomplish this ?

UPDATE:
I guess there is no easier way to just set the time and user/roles so I ended up implementing the answer(solution).

  • 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-06T00:02:43+00:00Added an answer on June 6, 2026 at 12:02 am

    You could write a custom Authorize attribute and override the AuthorizeCore method in which you would perform the necessary check:

    public class MyAuthorizeAttribute : AuthorizeAttribute
    {
        protected override bool AuthorizeCore(HttpContextBase httpContext)
        {
            var authorized = base.AuthorizeCore(httpContext);
            if (!authorized)
            {
                return false;
            }
    
            // At this stage standard authorization passed =>
            // you could now check the user roles in the database
            // and the time of the day and return true or false from here
    
            ...
        }
    }
    

    and now all that’s left is decorate your controllers/actions with this custom attribute.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is there any convenient way to integrate ASP.NET MVC validation (I am primarily interested
We have ASP.NET MVC 3 application which is integrated with Google Checkout API .
I have a site built using asp.net mvc running on IIS 7 using integrated
I've integrated some pages written in ASP.NET MVC 2, into a classic webform app.
I've integrated Asp.net MVC with Sharepoint site. It works great. But I'm using default
I'm creating one-click python installer (integrated with my application). Is there any way to
We are attempting to integrate an ASP.NET MVC site with our client's SSO system
Hi I have integrated Facebook with asp.net web site through open id But now
i am finding more and more my asp.net mvc views are starting to look
I am working on an Filter Attribute for ASP.Net MVC that will return a

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.