Why does the Authorize annotation create a 404 error and not a 401 error? The Next CEO of Stack OverflowWhy does AuthorizeAttribute redirect to the login page for authentication and authorization failures?Authorize redirect 401 not workingSpring MVC AccessDeniedException 500 error received instead of custom 401 error for @PreAuthorized unauth requestsDebugging web application in service fabric - View error returns 404.NET Core 2.0 Authorization filter causes an internal errorGetting 404 error instead of 401, when token is expired or when token is not passed Asp.net core 2Authorization error (401) in .net core when calling api to api in windows authenticationJWT Authorization in .NET Core — 401 ErrorHow can I route 401 and 403 errors?Using multiple paginated lists on one HTML page

Is this a new Fibonacci Identity?

Can this transistor (2N2222) take 6 V on emitter-base? Am I reading the datasheet incorrectly?

How to coordinate airplane tickets?

Car headlights in a world without electricity

Direct Implications Between USA and UK in Event of No-Deal Brexit

Upgrading From a 9 Speed Sora Derailleur?

Gödel's incompleteness theorems - what are the religious implications?

How did scripture get the name bible?

What is the difference between 서고 and 도서관?

pgfplots: How to draw a tangent graph below two others?

Is it possible to make a 9x9 table fit within the default margins?

Find the majority element, which appears more than half the time

Find a path from s to t using as few red nodes as possible

What does this strange code stamp on my passport mean?

Is it correct to say moon starry nights?

What difference does it make matching a word with/without a trailing whitespace?

Can I cast Thunderwave and be at the center of its bottom face, but not be affected by it?

Why was Sir Cadogan fired?

My boss doesn't want me to have a side project

Can Sri Krishna be called 'a person'?

What did the word "leisure" mean in late 18th Century usage?

Why did early computer designers eschew integers?

Prodigo = pro + ago?

Can a PhD from a non-TU9 German university become a professor in a TU9 university?



Why does the Authorize annotation create a 404 error and not a 401 error?



The Next CEO of Stack OverflowWhy does AuthorizeAttribute redirect to the login page for authentication and authorization failures?Authorize redirect 401 not workingSpring MVC AccessDeniedException 500 error received instead of custom 401 error for @PreAuthorized unauth requestsDebugging web application in service fabric - View error returns 404.NET Core 2.0 Authorization filter causes an internal errorGetting 404 error instead of 401, when token is expired or when token is not passed Asp.net core 2Authorization error (401) in .net core when calling api to api in windows authenticationJWT Authorization in .NET Core — 401 ErrorHow can I route 401 and 403 errors?Using multiple paginated lists on one HTML page










0















Just curious. I'm trying to make a dynamic error page instead of a different error page for each error in my .NET Core Razor Pages app. I'm adding [Authorize(Roles="teamleader")] to the appropriate controller but when I test it, the inspector tells me that it's a 404 - Not Found error and not a 401 - Unauthorized error. Anyone know why? Do you need to see some code?










share|improve this question

















  • 2





    It's hard to tell with so little information, but my guess here is that it's redirecting you to something like /Account/Login and it's that URL that 404s.

    – Kirk Larkin
    Mar 7 at 22:13











  • check your web browser network tab to see the which request is 404.

    – Tao Zhou
    Mar 8 at 3:04















0















Just curious. I'm trying to make a dynamic error page instead of a different error page for each error in my .NET Core Razor Pages app. I'm adding [Authorize(Roles="teamleader")] to the appropriate controller but when I test it, the inspector tells me that it's a 404 - Not Found error and not a 401 - Unauthorized error. Anyone know why? Do you need to see some code?










share|improve this question

















  • 2





    It's hard to tell with so little information, but my guess here is that it's redirecting you to something like /Account/Login and it's that URL that 404s.

    – Kirk Larkin
    Mar 7 at 22:13











  • check your web browser network tab to see the which request is 404.

    – Tao Zhou
    Mar 8 at 3:04













0












0








0








Just curious. I'm trying to make a dynamic error page instead of a different error page for each error in my .NET Core Razor Pages app. I'm adding [Authorize(Roles="teamleader")] to the appropriate controller but when I test it, the inspector tells me that it's a 404 - Not Found error and not a 401 - Unauthorized error. Anyone know why? Do you need to see some code?










share|improve this question














Just curious. I'm trying to make a dynamic error page instead of a different error page for each error in my .NET Core Razor Pages app. I'm adding [Authorize(Roles="teamleader")] to the appropriate controller but when I test it, the inspector tells me that it's a 404 - Not Found error and not a 401 - Unauthorized error. Anyone know why? Do you need to see some code?







razor asp.net-core authorization






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Mar 7 at 19:53









athomasathomas

397




397







  • 2





    It's hard to tell with so little information, but my guess here is that it's redirecting you to something like /Account/Login and it's that URL that 404s.

    – Kirk Larkin
    Mar 7 at 22:13











  • check your web browser network tab to see the which request is 404.

    – Tao Zhou
    Mar 8 at 3:04












  • 2





    It's hard to tell with so little information, but my guess here is that it's redirecting you to something like /Account/Login and it's that URL that 404s.

    – Kirk Larkin
    Mar 7 at 22:13











  • check your web browser network tab to see the which request is 404.

    – Tao Zhou
    Mar 8 at 3:04







2




2





It's hard to tell with so little information, but my guess here is that it's redirecting you to something like /Account/Login and it's that URL that 404s.

– Kirk Larkin
Mar 7 at 22:13





It's hard to tell with so little information, but my guess here is that it's redirecting you to something like /Account/Login and it's that URL that 404s.

– Kirk Larkin
Mar 7 at 22:13













check your web browser network tab to see the which request is 404.

– Tao Zhou
Mar 8 at 3:04





check your web browser network tab to see the which request is 404.

– Tao Zhou
Mar 8 at 3:04












0






active

oldest

votes












Your Answer






StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55051832%2fwhy-does-the-authorize-annotation-create-a-404-error-and-not-a-401-error%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes















draft saved

draft discarded
















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55051832%2fwhy-does-the-authorize-annotation-create-a-404-error-and-not-a-401-error%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Save data to MySQL database using ExtJS and PHP [closed]2019 Community Moderator ElectionHow can I prevent SQL injection in PHP?Which MySQL data type to use for storing boolean valuesPHP: Delete an element from an arrayHow do I connect to a MySQL Database in Python?Should I use the datetime or timestamp data type in MySQL?How to get a list of MySQL user accountsHow Do You Parse and Process HTML/XML in PHP?Reference — What does this symbol mean in PHP?How does PHP 'foreach' actually work?Why shouldn't I use mysql_* functions in PHP?

Compiling GNU Global with universal-ctags support Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 23, 2019 at 23:30 UTC (7:30pm US/Eastern) Data science time! April 2019 and salary with experience The Ask Question Wizard is Live!Tags for Emacs: Relationship between etags, ebrowse, cscope, GNU Global and exuberant ctagsVim and Ctags tips and trickscscope or ctags why choose one over the other?scons and ctagsctags cannot open option file “.ctags”Adding tag scopes in universal-ctagsShould I use Universal-ctags?Universal ctags on WindowsHow do I install GNU Global with universal ctags support using Homebrew?Universal ctags with emacsHow to highlight ctags generated by Universal Ctags in Vim?

Add ONERROR event to image from jsp tldHow to add an image to a JPanel?Saving image from PHP URLHTML img scalingCheck if an image is loaded (no errors) with jQueryHow to force an <img> to take up width, even if the image is not loadedHow do I populate hidden form field with a value set in Spring ControllerStyling Raw elements Generated from JSP tagds with Jquery MobileLimit resizing of images with explicitly set width and height attributeserror TLD use in a jsp fileJsp tld files cannot be resolved