How to get aspnet_Users.UserId for an anonymous user in ASP.NET membership ?
Posted
by Simon_Weaver
on Stack Overflow
See other posts from Stack Overflow
or by Simon_Weaver
Published on 2009-10-25T05:40:27Z
Indexed on
2010/05/15
13:14 UTC
Read the original article
Hit count: 501
asp.net-membership
|anonymous-users
I am trying to get the aspnet membership UserId
field from an anonymous user.
I have enabled anonymous identification in web.config :
<anonymousIdentification enabled="true" />
I have also created a profile:
<profile>
<providers>
<clear />
<add name="AspNetSqlProfileProvider" type="System.Web.Profile.SqlProfileProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
connectionStringName="ApplicationServices"
applicationName="/" />
</providers>
<properties>
<add name="Email" type="System.String" allowAnonymous="true"/>
<add name="SomethingElse" type="System.Int32" allowAnonymous="true"/>
</properties>
</profile>
I see data in my aspnetdb\aspnet_Users
table for anonymous users that have had profile information set.
Userid PropertyNames PropertyValuesString
36139818-4245-45dd-99cb-2a721d43f9c5 Email:S:0:17: [email protected]
I just need to find how to get the 'Userid' value.
It is not possible to use :
Membership.Provider.GetUser(Request.AnonymousID, false);
The Request.AnonymousID is a different GUID and not equal to 36139818-4245-45dd-99cb-2a721d43f9c5.
Is there any way to get this Userid. I want to associate it with incomplete activity for an anonymous user. Using the primary key of aspnet_Users
is preferable to having to create my own GUID (which I could do and store in the profile).
This is basically a dupe of this question but the question was never actually answered.
© Stack Overflow or respective owner