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.
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 ApplicationId 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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With