<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Fredrik Haglund's blog &#187; Membership Provider</title>
	<atom:link href="http://blog.fredrikhaglund.se/blog/tag/membership-provider/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.fredrikhaglund.se</link>
	<description>Chatter about EPiServer, ASP.NET, CSS and Web Development.</description>
	<lastBuildDate>Tue, 28 Jun 2011 13:37:32 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Can&#8217;t find provider capability information for provider [XYZ]</title>
		<link>http://blog.fredrikhaglund.se/blog/2007/09/28/cant-find-provider-capability-information-for-provider-xyz/</link>
		<comments>http://blog.fredrikhaglund.se/blog/2007/09/28/cant-find-provider-capability-information-for-provider-xyz/#comments</comments>
		<pubDate>Fri, 28 Sep 2007 20:17:50 +0000</pubDate>
		<dc:creator>Fredrik Haglund</dc:creator>
				<category><![CDATA[EPiServer]]></category>
		<category><![CDATA[EPiServer 5]]></category>
		<category><![CDATA[Membership Provider]]></category>
		<category><![CDATA[ProviderCapabilitySettings]]></category>

		<guid isPermaLink="false">http://blog.fredrikhaglund.se/?p=42</guid>
		<description><![CDATA[I noticed that there is a problem with using ASP.NET membership providers in EPiServer CMS (5.1.422). When going to edit mode you get the following exception: [EPiServerException: Can't find provider capability information for provider [XYZ].] EPiServer.Security.ProviderCapabilities.IsSupported(String providerName, Action action) +117 EPiServer.UI.Edit.UserMembership.EnableFields() +418 EPiServer.UI.Edit.UserMembership.OnLoad(EventArgs e) +1201 The reason is because EPiServer only has hardcoded the capabilites [...]]]></description>
			<content:encoded><![CDATA[<p>I noticed that there is a problem with using ASP.NET membership providers in EPiServer CMS (5.1.422). When going to edit mode you get the following exception:</p>
<p><code>[EPiServerException: Can't find provider capability information for provider [XYZ].]<br />
EPiServer.Security.ProviderCapabilities.IsSupported(String providerName, Action action) +117<br />
EPiServer.UI.Edit.UserMembership.EnableFields() +418<br />
EPiServer.UI.Edit.UserMembership.OnLoad(EventArgs e) +1201</code></p>
<p>The reason is because EPiServer only has hardcoded the capabilites for some of the default providers name like this:</p>
<p><code>static ProviderCapabilities()<br />
{<br />
_providerDictionary = new Dictionary();<br />
_providerDictionary.Add("SqlServerMembershipProvider", new ProviderCapabilitySettings(true, true, true, new object[] { "email", true, "comment", true }));<br />
_providerDictionary.Add("WindowsMembershipProvider", new ProviderCapabilitySettings(false, false, false, new object[] { "email", true, "comment", false }));<br />
_providerDictionary.Add("SqlServerRoleProvider", new ProviderCapabilitySettings(true, true, true));<br />
_providerDictionary.Add("WindowsRoleProvider", new ProviderCapabilitySettings(false, false, false));<br />
}</code></p>
<p>To get it to work if you have providers with other names you must obviously register them manually (at least until EPiServer provides a better sollution) in Global.asax.cs. This is how I did it:</p>
<p><code>private void RegisterCapabilitiesOnMembershipProviders()<br />
{<br />
string defaultMembershipProviderName = ProviderFacade.GetDefaultMembershipProviderName();<br />
string defaultRoleProviderName = ProviderFacade.GetDefaultRoleProviderName();</code><code>ProviderCapabilities.AddProvider(defaultMembershipProviderName, new ProviderCapabilitySettings(false, false, false, new object[] { "email", true, "comment", false }));<br />
ProviderCapabilities.AddProvider(defaultRoleProviderName, new ProviderCapabilitySettings(false, false, false));<br />
}</code><code>protected void Application_Start(Object sender, EventArgs e)<br />
{<br />
RegisterCapabilitiesOnMembershipProviders();<br />
}</code></p>
<p><strong>Update:</strong> <a href="http://www.episerver.com/en/EPiServer_Knowledge_Center/Documentation/Release-Notes/Release-Notes---EPiServer-CMS-5-SP1/">This has changed in SP1 so it uses the class type and not the name.</a> So a rename of a provider does not require registration but you must register capabilities if you write your own.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.fredrikhaglund.se/blog/2007/09/28/cant-find-provider-capability-information-for-provider-xyz/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

