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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T18:20:53+00:00 2026-06-11T18:20:53+00:00

I have two controllers; AccountController : Controller //For accounts <– MVC ItemController : ApiController

  • 0

I have two controllers;

  • AccountController : Controller //For accounts <-- MVC
  • ItemController : ApiController //For Items <-- WEB API

The accounts controller is for all intents and purposes a pretty standard implementation of the Accounts code, the only major difference is that it’s using a Custom MembershipProvider. On the accounts controller I also have one other Action:

[Authorize]
public ActionResult Bleh(){ return View(); }

Which if I attempt to get to:

http://localhost/Account/Bleh

Redirects me (as expected) to the Login page, which after logging in, returns me back to the Bleh page. All good. The problem is on the ItemController, I have an Action which too has an Authorize attribute on it:

[Authorize]
public HttpResponseMessage PostItem(Item item) { /**/ }

Going to this before logging in returns a 401 – Unauthorized – which again is as expected, but after logging in, it still returns a 401. I can’t see why this is the case.

Am I missing any configuration elements? Routing? N.E. Other?

I was under the impression that Web Api would pick up the Forms Authentication in the same way as MVC, and I know the authentication is working as the MVC one is working.

  • 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-11T18:20:54+00:00Added an answer on June 11, 2026 at 6:20 pm

    I have rebuilt the application from scratch, and the forms code is working as expected now. I cannot for the life of me see any difference between my original code and the new code. I suspect maybe something in a config file somewhere, but after a pretty substantial amount of time it eludes me.

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

Sidebar

Related Questions

In VS2010 I have two MVC 2 based web apps within the same solution
If I have two controllers: public class PrimaryController : Controller { private IRepository<Primaries> repository;
I have two controllers, user and module. By default the user controller is loaded
I have two controllers, one is base controller, other is subject in the base
I have two view controllers, call them viewA and ViewB All the action happens
In my Asp.net MVC app, I have two methods on a controller, one for
I have two view controllers, in which I am using navigation controller to navigate
I have two view controllers and nibs. I populated one view controller with a
I have two view controllers and nibs. I populated one view controller with a
I have two controllers, both called AccountController . One of them, lets call it

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.