BlogEngine.NET 2.0 - Active Directory using XML Roles Provider

Topics: ASP.NET 2.0
Jun 21, 2011 at 11:00 AM

HI All,

I am trying to set up BlogEngine.NET 2.0 on an internal network with a domain.  Using some of the posts here I have managed to get the AD conenctor working to allow users to authenticate without having to log in (using Windows authentication in IIS and in web.config). 

What I want to do now is use the roles.xml file to determine which windows user accounts should be assigned to which roles within this blog. 

Is this possible and how do you go about it?  If not, should I deploy the BlogEngne.NET ADRP which is on CodePlex and use Active Directory groups?

Regards

A

Jun 21, 2011 at 4:38 PM

You would need to modify web.config to make XmlRoleProvider the default role provider. Basically you need to copy the relevant bit from web.config configured to use Xml blog providers.

It might work, unless there are crossdependancies in code. These can be resolved though.

Jun 21, 2011 at 4:57 PM

I have this as the default role provider already, what im after is what to put in the roles.xml to determine who is an editor, administrator and normal user.  For example if my domain is XYZ,  it tried putting XYZ\user1 into the admin role in xml file and it did not give me the admin panel when i logged in.

Any ideas?

A

Jun 21, 2011 at 5:34 PM

What if you use Web Site Administration Tool?

Jun 22, 2011 at 9:14 AM

This particular site is hosted on Windows2003/IIS6 server so I dont have access to the IIS admin tool.  I could build a site on another Win2008 server, however if you have BE2.0 running in this configuration, could you give me an example of what is stored inside your roles.xml file?

Thanks

A

Jun 22, 2011 at 3:17 PM

HI Neuromancer/Anyone reading this post,

I have worked out what was causing my issue,  the AD provider was working fine and I had the right data in the roles.xml file (i.e. DOMAIN\USER) but I had the roles provider caching the roles.xml in a cookie which had not been expiring while I was working on it.  So ive switched off the cacheRolesInCookie option on the rolesProvider section in the config and we are now up and running perfectly

Thanks for your help Neuromancer.

Andy

Jun 22, 2011 at 5:00 PM

Great stuff Andy,

BTW Web Site Administration Tool is actually in Visual Studio. Open your project and select Project | ASP.NET Configuration and you will be able to interactively set up users and roles.

Cheers

Jun 30, 2011 at 1:57 PM

It appears BE2.0 caches the roles.xml file at the IIS level as well, so Ive had to set my app pool to recycle every 60 mins as a workaround, however if anyone knows a way that on the server we can prevent this from caching in the app pool this would be fantastic.

Thanks

A