I am using the MembershipProvider and due to the way I have set it up with in conjunction with some custom security I need to get the ApplicationId (Guid) of the current application. It is easy to get the application name using Membership.ApplicationName, but I have found no easy way to get the Id.
+3
A:
I believe you will need to write your own code (like a custom stored procedure) to get the ID. This data is intended for private use by the built in implementation of the membership provider and is not part of the provider interface (i.e. it may not exist in some implementations of the provider). Same goes for the user ID. The good news is that writing a stored procedure for the default implementation is pretty straight forward.
You just need to:
SELECT FROM aspnet_Applications
WHERE ApplicationName =
(System.Web.Security.Membership.Provider.ApplicationName
from the ASP.NET code)
You may want to rethink if you really need this ID
Stilgar
2009-06-14 23:46:03
I think you are correct, there is no way built in the framework to get think. Custom SQL is the only way.
Craig
2009-06-15 00:02:39