CREATE TABLE [dbo].[aspnet_Membership](
[ApplicationId] [uniqueidentifier] NOT NULL,
[UserId] [uniqueidentifier] NOT NULL,
Is there any easy ways to use and integer value as UserID (not this encrypted …)
I really need integer :-/
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You could easily write a custom membership provider that uses your database rather than the default ASP.NET one.
This is the main reason Microsoft went down the provider model, they have supplied an interface that you need to implement, and then the other tools (UI, access controls, etc) can all work with it.
A sample implementation can be found on MSDN:
You’ll notice that the
ProviderUserKeyon the MembershipUser is an Object, not a GUID, so you can use an Int, String, or whatever does it for you.Another option would be to store this link in the users Profile, and then do the relevant lookups from there, but that wouldn’t be as clean.
Edit to respond to comment
Well, it depends on where you want to do the work really. If you are happy to replicate the ASP.NET Membership stored procedures in your SQL database, you could get away with creating a class that (like the sample) inherits from
MembershipProviderand only provide an override of theCreateUsermethod to create an integer based key, rather than a GUID based one.Basically, the sample is showing you a complete implementation of a membership provider – all of those methods are implemented in much the same way in MembershipProvider, the
overridekeyword on the methods and properties is telling the framework “Use my methods instead of the base class methods please”.