Retrieve the Membership provider name of a Windows SharePoint Services 3.0 or MOSS Extranet Web Application
The following code sample enumerate all Web Application zones. It retrieves the Form Based Authentication zone.Then it retrieves the name of the Membership provider.
Using Microsoft.SharePoint;
Using Microsoft.Sharepoint.Administration;
.
.
.
string memberShipProviderName = string.Empty;
SPWeb myWeb = SPContext.Current.Web;
System.Collections.Generic.Dictionary<SPUrlZone, SPIisSettings> myDictionnary = new System.Collections.Generic.Dictionary<SPUrlZone, SPIisSettings>();
myDictionnary = myWeb.Site.WebApplication.IisSettings;
foreach (Microsoft.SharePoint.Administration.SPUrlZone aZone in Enum.GetValues(typeof(Microsoft.SharePoint.Administration.SPUrlZone)))
{
if (myDictionnary.ContainsKey(aZone))
{
if (myDictionnary[aZone].AuthenticationMode == System.Web.Configuration.AuthenticationMode.Forms)
{
memberShipProviderName = myDictionnary[aZone].MembershipProvider.ToString();
}
}
}


1 Comments:
Very Useful.
Thanks
Post a Comment
Subscribe to Post Comments [Atom]
Links to this post:
Create a Link
<< Home