I have separated the Models into Specific project
After that MVC default [Authorize] attribute not working in my application
When i try to login the application it is not login the application nor it is redirecting to the specific page
I have separated the Models into Specific project
After that MVC default [Authorize] attribute not working in my application
When i try to login the application it is not login the application nor it is redirecting to the specific page
For me, I needed to set the following appSetting
to
Do you have something like this
in your web.config?
I had the same issue with Authorize not working. At first I thought it was the code. But everything was right - it built with no errors. I then restarted my dev machine and it started working. It worked the first time, then had the same issue with it not working. Think it must be storing the value from the first cycle and not clearing it. (only a theory)
Check if you have removed the forms authorization module. Some of the new templates remove forms authorization by default. If it has been removed, comment it out. It will look like this in your web.config:
I found this question looking for a very similar error, so I thought it would be good to post my solution.
For me It has a very trivial mistake. I was authenticated yet. Owin Authentication remains the user logged in despite the browsers close. I need to express logoff with following code:
I just ran into this issue today, and wanted to add my solution for anyone who might also run into this error. Nothing else worked for me. I had recently done an installer for one of the other projects in this solution, and I must have unchecked the "Build" box in Configuration Manager.
With that unchecked, it didn't re-build when I added the [Authorize] tag, even though I did make cshtml page changes that were showing up. I didn't figure it out until I put a breakpoint in my controller action and noticed that I never hit it. I even tried returning null from the controller, and the application still navigated to the new page.
So, long story short, check to make sure you are Building that project in Configuration Manager, that's what worked for me.