WebConfigRoleProvider in IIS7

Jul 20, 2010 at 10:39 PM

How to make it work with IIS7?

I tried adding this to configuration element in web.config:

<sectionGroup name="system.web">
    <section name="WebConfigRoleProvider" type="WebConfigRoleProvider.Core.ConfigurationSection" requirePermission="false"/>
</sectionGroup>

But intellinsense says WebConfigRoleProvider is an invalid child element for system.web

Coordinator
Jul 21, 2010 at 2:03 PM

Did you add a reference to the schema in Visual Studio? That's probably why it's complaining... Other than Intellisense, is the provider working for you as expected?

Jul 22, 2010 at 2:14 AM
I added the reference to the project, also referenced it in the configuration element in web.config, I tried:
<section name="WebConfigRoleProvider" type="......" />

also
<sectionGroup name="WebConfigRoleProvider" type="......" />

and
<sectionGroup name="system.web">
   <section name="WebConfigRoleProvider" type="......" />
</sectionGroup>

When I run the application it fails with an IIS message error about misconfiguration in web.config file. Once I remove elements related to WebConfigRoleProvider it works again.


2010/7/21 JakobG <notifications@codeplex.com>

From: JakobG

Did you add a reference to the schema in Visual Studio? That's probably why it's complaining... Other than Intellisense, is the provider working for you as expected?

Read the full discussion online.

To add a post to this discussion, reply to this email (webconfigroles@discussions.codeplex.com)

To start a new discussion for this project, email webconfigroles@discussions.codeplex.com

You are receiving this email because you subscribed to this discussion on CodePlex. You can unsubscribe on CodePlex.com.

Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online at CodePlex.com


Coordinator
Jul 22, 2010 at 3:11 AM

Would it be possible for you to post your whole web.config? Either here or drop me an email, jakob.gade@mail.dk. Then I'll take a closer look...

Jul 26, 2010 at 6:46 PM
Edited Jul 26, 2010 at 6:56 PM

Hello, solved first error. I modified the configuration element, now Intellisense recognize the WebConfigRoleProvider element. Web.config content is as follows:

<?xml version="1.0"?>
<configuration>
	<configSections>
		<sectionGroup name="system.web.extensions" 
type="System.Web.Configuration.SystemWebExtensionsSectionGroup, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"> <sectionGroup name="scripting"
type
="System.Web.Configuration.ScriptingSectionGroup, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"> <section name="scriptResourceHandler"
type="System.Web.Configuration.ScriptingScriptResourceHandlerSection, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
requirePermission="false" allowDefinition="MachineToApplication"/> <sectionGroup name="webServices"
type="System.Web.Configuration.ScriptingWebServicesSectionGroup, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"> <section name="jsonSerialization"
type="System.Web.Configuration.ScriptingJsonSerializationSection, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
requirePermission
="false" allowDefinition="Everywhere"/> <section name="profileService"
type="System.Web.Configuration.ScriptingProfileServiceSection, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
requirePermission="false" allowDefinition="MachineToApplication"/> <section name="authenticationService"
type="System.Web.Configuration.ScriptingAuthenticationServiceSection, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
requirePermission="false" allowDefinition="MachineToApplication"/> </sectionGroup> </sectionGroup> </sectionGroup> <sectionGroup name="WebConfigRoleProvider" type="WebConfigRoleProvider.Core.ConfigurationSection"> <section name="roles" type="WebConfigRoleProvider.Core.ConfigurationSection"> </section> </sectionGroup> </configSections> <WebConfigRoleProvider> <roles> <add name="role1" users="user1" /> </roles> </WebConfigRoleProvider> <system.web> <authentication mode="Forms"> <forms loginUrl="login.aspx" defaultUrl="login.aspx" cookieless="AutoDetect"> <credentials passwordFormat="Clear"> <user name="user1" password="passwrd"></user> </credentials> </forms> </authentication> <roleManager enabled="true" defaultProvider="WebConfigRoleProvider"> <providers> <add name="WebConfigRoleProvider" type="WebConfigRoleProvider.Core.WebConfigRoleProvider"/> </providers> </roleManager> <pages theme="default"> <controls> <add tagPrefix="asp" namespace="System.Web.UI" assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/> </controls> </pages> <!-- Set compilation debug="true" to insert debugging
symbols into the compiled page. Because this
affects performance, set this value to true only
during development.
-->
<compilation debug="true"> <assemblies> <add assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/> <add assembly="System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/> <add assembly="System.Deployment, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/> <add assembly="System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/> <add assembly="System.Web.Extensions.Design, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/> <add assembly="System.DirectoryServices, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/> </assemblies> </compilation> <httpHandlers> <remove verb="*" path="*.asmx"/> <add verb="*" path="*.asmx" validate="false"
type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/> <add verb="*" path="*_AppService.axd" validate="false"
type
="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/> <add verb="GET,HEAD" path="ScriptResource.axd"
type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" validate="false"/> </httpHandlers> <httpModules> <add name="ScriptModule" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/> </httpModules> </system.web> <system.webServer> <validation validateIntegratedModeConfiguration="false"/> <modules> <add name="ScriptModule" preCondition="integratedMode" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/> </modules> <handlers> <remove name="WebServiceHandlerFactory-Integrated"/> <add name="ScriptHandlerFactory" verb="*" path="*.asmx" preCondition="integratedMode"
type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/> <add name="ScriptHandlerFactoryAppServices" verb="*" path="*_AppService.axd" preCondition="integratedMode"
type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/> <add name="ScriptResource" preCondition="integratedMode" verb="GET,HEAD" path="ScriptResource.axd"
type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/> </handlers> </system.webServer> </configuration>

 

 

Then, when I executed the application a Server error appears: Application Server Error. Security Exception

Stack trace:

 

[SecurityException: System.Security.SecurityException: Request for the permission of type 'System.Web.AspNetHostingPermission, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.]

System.Reflection.Assembly._GetType(String name, Boolean throwOnError, Boolean ignoreCase) +0

System.Web.Compilation.CompilationUtil.GetTypeFromAssemblies(AssemblyCollection assembliesCollection, String typeName, Boolean ignoreCase) +227

System.Web.Compilation.BuildManager.GetType(String typeName, Boolean throwOnError, Boolean ignoreCase) +362

System.Web.Configuration.ConfigUtil.GetType(String typeName, String propertyName, ConfigurationElement configElement, XmlNode node, Boolean checkAptcaBit, Boolean ignoreCase)


I searched for this error on the Internet, and found http://dbvt.com/blog/post/AspNetHostingPermission-Security-Exception-Fix-with-Ajax-in-IIS7.aspx, which suggests to set "Load user profile=true".


Now, I get a Configuration Error:
Línea 39: 		<roleManager enabled="true" defaultProvider="WebConfigRoleProvider">
Línea 40: <providers>
Línea 41: <add name="WebConfigRoleProvider" type="WebConfigRoleProvider.Core.WebConfigRoleProvider"/>
Línea 42: </providers>
Línea 43: </roleManager>
Coordinator
Aug 2, 2010 at 6:49 PM
What version of .NET are you using? I noticed your SectionGroup tags has references to dlls with Version=1.0.61025.0. The Web.Config Role Provider is developed using .NET 3.5 and I'm not sure it'll work with older versions of the .NET framework.
Aug 2, 2010 at 9:26 PM

I'm using .NET 2.0 with MS AJAX extensions

Dec 6, 2011 at 3:28 PM

I've got the same Problem.

And the Solution: I downloaded the Sourcecode and copied the WebconfigRoleProvider.Core from the example project => it works. (without any changes in my web.config)

Maybe the releaseVersion of WebconfigRoleProvider.Core.dll isn't the lates version.

Coordinator
Dec 7, 2011 at 5:41 AM

Thank you for your interest in the WebConfigRoleProvider. It's been a while since the last activity on the project, I'll see if I can fix the issue you describe by updating the release version.