SFRS.com and ASP.NET 2.0 Security …
by B.Russell on Jul.09, 2007, under Win32
Finally, after days of toying and learning how the new Authorization system in .NET 2.0 worked I managed to get it to work properly on my Win2k3 box for the production server. If you have ever worked with the new Authorization system in 2.0 .NET then you may already know the troubles you can run into.
I implement a MySQL 5.0 server system for all my websites currently so I needed to write my own Authorization systems to work with MySQL. The only ones supported out of the box was a MDF SQL Server file for use with MS SQL Server Express, MS SQL Server, Windows Auth, and I believe a Active Directory version. Once I implemented my own library for use with MySQL server + Authorization I implemented it on my latest version of the Sumiton Fire and Rescue site on my local Vista Dev box. Well of course it ran fine and worked fine on it. When the time came to do a push to my production server ( Windows Server 2003 box ) nothing worked. Go figure =/.
Over the next few days I managed to track down the problem, which was a silly one if you ask me. I ended up removing the System.Authorization tags and allowdeny tags from the main web.config file located in the main branch of the site, and creating a new web.config file inside the directories that needed security with just the allowdeny tags. After some forum reading, I managed to get the tags just right and BINGO !!! A new .NET 2.0 Authorization system that works fully with MySQL on the backend.
I still can’t see why putting the allowdeny tags in the main config file worked on dev box, yet borked on production. Microsoft, I swear they love messing with us developers sometimes. =/
-Brandon
One Tired Dev Monkey