Author: AndyW2009 | Posted on: 8/24/2009 10:47:38 PM | Views : 346

Hi,
Apologies if this is in the wrong forum.

  Can anyone tell me how to query the MembershipProviderCollection returned by a call to Membership.Providers using LINQ.

Specifically I need to return a provider by its ApplicationName property.

In effect I want to  execute something like :   SELECT provider FROM Membership.Providers where  ApplicationName = MyApplicationName.


Currently I have a foreach( MembershipProvider....) statement which I use to iterate through the list of providers in the web.config  and I then check the ApplicationName property to see if it is the one I want. However, I have found that if the provider is accessed, it checks to see if it is valid (has permissions to access its provider store - such as the database) and throws an exception if it does not.   Since the permissions are set by the application I do not want to check providers that do not belong to ...

Go to the complete details ...