An interesting problem arose for me today when I upgraded my root website from ASP.NET MVC 3Preview 1 to the new
Beta 1. I am using RavenDB, which needs to run as a virtual sub-application with Windows authentication instead of Forms authentication. I had raven working like described above just fine in preview 1, but with beta 1, now it won't work.
It looks like no matter what I try, the membership
provider system for my root website is redirecting me back to the login page, even though I've set my RavenDB virtual directory to use
windows authentication and cleared out the membership and roles providers in it's web.config. I guess MS changed something to do with
either routing or authentication between preview 1 and beta 1. If anyone else sees this problem and knows how to fix it, I would be in
your debt.
I would guess that the easiest way to recreate the problem would be to create a new ASP.NET MVC 3 Beta 1 root website, then add a virtual directory marked as an application. See if you can get the root site to use the forms auth provided by default, but
have the virtual directory use windows auth, denying all users but a specific one of your choosing. I can't seem to get this scenario working in the beta like I did in the preview.
It looks like no matter what I try, the membership
provider system for my root website is redirecting me back to the login page, even though I've set my RavenDB virtual directory to use
windows authentication and cleared out the membership and roles providers in it's web.config. I guess MS changed something to do with
either routing or authentication between preview 1 and beta 1. If anyone else sees this problem and knows how to fix it, I would be in
your debt.
There’s a known issue that causes Forms Authentication to always redirect unauthenticated users to ~/Account/Login, ignoring the forms authentication setting used in Web.config. The workaround is to add the following app setting.
?
<add key="autoFormsAuthentication" value="false" />
"And whoever is removed away from the Fire and admitted to Paradise, he indeed is successful." (The Holy Quran)
Excellent Windows VPS Hosting Imran Baloch MVP, MVB, MCP, MCTS, MCPD
Marked as answer by chrisaswain on Oct 18, 2010 01:58 PM
chrisaswain
Member
8 Points
15 Posts
ASP.NET MVC 3 Beta and Virtual Directory with different auth methods not working
Oct 17, 2010 04:28 PM|LINK
An interesting problem arose for me today when I upgraded my root website from ASP.NET MVC 3 Preview 1 to the new Beta 1. I am using RavenDB, which needs to run as a virtual sub-application with Windows authentication instead of Forms authentication. I had raven working like described above just fine in preview 1, but with beta 1, now it won't work. It looks like no matter what I try, the membership
provider system for my root website is redirecting me back to the login page, even though I've set my RavenDB virtual directory to use
windows authentication and cleared out the membership and roles providers in it's web.config. I guess MS changed something to do with
either routing or authentication between preview 1 and beta 1. If anyone else sees this problem and knows how to fix it, I would be in
your debt.
I would guess that the easiest way to recreate the problem would be to create a new ASP.NET MVC 3 Beta 1 root website, then add a virtual directory marked as an application. See if you can get the root site to use the forms auth provided by default, but have the virtual directory use windows auth, denying all users but a specific one of your choosing. I can't seem to get this scenario working in the beta like I did in the preview.
MVC 3 Beta 1
ricka6
All-Star
15070 Points
2272 Posts
Microsoft
Moderator
Re: ASP.NET MVC 3 Beta and Virtual Directory with different auth methods not working
Oct 18, 2010 03:47 AM|LINK
Routing is part of ASP.NET, it's not MVC specific and has not changed from Preview1 to Beta. The same is true for the authentication providers.
>>create a new ASP.NET MVC 3 Beta 1 root website, then add a virtual directory marked as an application.
Yes, that's the right approach.
imran_ku07
All-Star
45815 Points
7698 Posts
MVP
Re: ASP.NET MVC 3 Beta and Virtual Directory with different auth methods not working
Oct 18, 2010 04:22 AM|LINK
From Release notes at here,
http://www.asp.net/learn/whitepapers/mvc3-release-notes
Excellent Windows VPS Hosting
Imran Baloch MVP, MVB, MCP, MCTS, MCPD
chrisaswain
Member
8 Points
15 Posts
Re: ASP.NET MVC 3 Beta and Virtual Directory with different auth methods not working
Oct 18, 2010 04:24 AM|LINK
Looks like I solved the problem. Thanks to this post, and a comment from ScottGu in this one.
Apparently it's a bug in the MVC 3 Beta. You need to add the following to your appsettings in your config file:
I did this and now my windows auth works on my sub-application.MVC 3 Beta 1