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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T13:04:42+00:00 2026-06-08T13:04:42+00:00

I have edited my question and here is the code which I used for

  • 0

I have edited my question and here is the code which I used for implementing the authentication.

Class which inherits AuthorizeAttribute.

public class FBxAuth : AuthorizeAttribute
    {

        public FBxAuth()
            : base()
        {

        }
        protected override bool AuthorizeCore(HttpContextBase httpContext)
        {
            bool isAuthenticated = false;
            if (httpContext.User.Identity.IsAuthenticated)
            {
                // here I will check users exists in database.
                // if yes , isAuthenticated=true;
            }
            return isAuthenticated;
        }
        protected override void HandleUnauthorizedRequest(AuthorizationContext filterContext)
        {
            filterContext.HttpContext.Response.Redirect("/home/Register/?returningURL=" +
                filterContext.HttpContext.Server.UrlEncode(filterContext.HttpContext.Request.Url.ToString()));

        }

    }

My controller

[FBxAuth]
        public ActionResult Index()
        {
            teamDA = new TeamDataAccess();
            var teams = teamDA.TeamsList();

            return View(teams);
        }
  1. Am I following the correct way ?

2.How can I check the authenticated user is authorized to execute a action in controller.
For eg: delete .
www.abc.com/teams/5/delete will perform delete
I can hide the delete link from UI.
But if a user tries to delete by giving url mentioned above, how can i prevent him from executing the action ?

  • 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-08T13:04:44+00:00Added an answer on June 8, 2026 at 1:04 pm

    you have to do the same thing you did with your Index action, just add the [FBxAuth] or the common [Authorize] attribute to the action you want to be allowed access only to the authenticated users.

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

Sidebar

Related Questions

I have the following Models and ViewModels (edited for brevity): public class Advert {
I have this code inside a header (edited): template <int i> class A {};
I edited the question so it would make more sense. I have a function
I have this code that I've edited: http://pastebin.com/vrqHek6S I've put in comments where I
I have the following on a web servlet: EDITED: public String tryGoogleAuthentication(String auth_token){ HttpURLConnection
Here is the test code template <class T> void f() { T t; t.f<T>(0);
I have edited this question to make it easier to understand. I have an
I have some code which collects points (consed integers) from a loop which looks
Edited Question : I am working on a multithreaded JMS receiver and publisher code
Note: question has been edited to stay in sync with what I have tried

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.