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 8275825
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T08:11:41+00:00 2026-06-08T08:11:41+00:00

Can you explain the differences between HttpApplication.AuthenticateRequest and HttpApplication.AuthorizeRequest in ASP.NET MVC 3 please?

  • 0

Can you explain the differences between HttpApplication.AuthenticateRequest and HttpApplication.AuthorizeRequest in ASP.NET MVC 3 please? When will they occur? Assume this scenario:

My User has a property called IsBanned and I want to check his/her IsBanned property in each request. If it was true, I redirect the User to an error page. But not for all requests, just requests that their action signed by [Authorize] attribute. OK, atthis type of actions, will HttpApplication.AuthenticateRequest occur or HttpApplication.AuthorizeRequest or anything else?

I know I can check this property in SignIn|LogOn action. But I means this:

  • A user requests logging in
  • I check the property IsBanned and it was false
  • The user logged in
  • User view some pages of site
  • The admin banned the user (while he is logged in)
  • User requests a page (action) that have [Authorize] attribute
  • User is logged in (before this. remember?)
  • So I have to show the requested page
  • But the user give a banned flag by admin
  • How can I prevent user from viewing requested page?

Thanks in advance.

  • 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-08T08:11:42+00:00Added an answer on June 8, 2026 at 8:11 am

    I dont think you need to deal with either of HttpApplication.AuthenticateRequest or HttpApplication.AuthorizeRequest. I would solve it by using a custom Authorize Attribute.

    public class MyAuthorizeAttribute : AuthorizeAttribute {
    
            protected override bool AuthorizeCore(HttpContextBase httpContext) {
                bool authorizerPrimarily = base.AuthorizeCore(httpContext);
    
                if(authorizedPrimarily){
                   return user_not_banned;
                }
    
                return authorizerPrimarily;
            }
    }
    

    You can get user’s name from httpContext.User.Identity.Name. Use it to grab data from database.

    Update for comment-1

    To redirect banned users to a specific page, you may do this:

    if(authorizedPrimarily){
       if(user_banned){
          httpContext.Response.Redirect("url of banned message");
          return false;
       }
    
      return true;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Can someone please explain the major differences between Scala, Groovy and Clojure. I know
Hello can some please explain to me what are the differences between this configuration
Can please someone explain the differences between Functor and Monad in the Scala context?
Can someone please explain the differences between REPLACE, INSERT and UPDATE in MySQL?
Can somebody explain the main differences between (advantages / disadvantages) the two implementations? For
Can someone explain the differences between an Observable and a ConnectableObservable? The Rx Extensions
Can anyone explain in a clear way the practical differences between the java.lang.annotation.RetentionPolicy constants
Can somebody explain to me the main differences between the principles of encapsulation and
What are the differences between these 3 types of loading? Can someone explain with
Can anyone explain to me the differences between these two regex approaches: /(\d)\1/ /(\d){2,}/

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.