This post show how to retrieve the Asp .Net Form Based Authentication DataBase Connection String Name of a MOSS or Windows SharePoint Services 3.0 Web Application by server side C# programming.
This is the following of the previous post : How to retrieve the Membership provider name . Knowing the name of the membership provider you can retrieve the Asp .Net Form Based Authentication DataBase Connection String Name in the web.config file of your web application doing this :
Code Sample:
This is the following of the previous post : How to retrieve the Membership provider name . Knowing the name of the membership provider you can retrieve the Asp .Net Form Based Authentication DataBase Connection String Name in the web.config file of your web application doing this :
string connexionStringName = string.Empty;
//we retrieve the connection string used for the form authentication based membershipprovider
System.Web.Configuration.MembershipSection mysection = (System.Web.Configuration.MembershipSection)ConfigurationManager.GetSection(@"system.web/membership");
for (int j = 0; j < mysection.Providers.Count; j++)
{
if (mysection.Providers[j].Name == memberShipProviderName)
{
connexionStringName = mysection.Providers[j].ElementInformation.Properties["connectionStringName"].Value.ToString();
}
}
No comments:
Post a Comment