【发布时间】:2010-12-09 20:35:28
【问题描述】:
我正在尝试从匿名用户那里获取 aspnet 成员 UserId 字段。
我在 web.config 中启用了匿名识别:
<anonymousIdentification enabled="true" />
我还创建了个人资料:
<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>
我在aspnetdb\aspnet_Users 表中看到已设置个人资料信息的匿名用户的数据。
Userid PropertyNames PropertyValuesString
36139818-4245-45dd-99cb-2a721d43f9c5 Email:S:0:17: me@example.com
我只需要找到如何获取 'Userid' 值。
无法使用:
Membership.Provider.GetUser(Request.AnonymousID, false);
Request.AnonymousID 是不同的 GUID,不等于 36139818-4245-45dd-99cb-2a721d43f9c5。
有什么方法可以得到这个 Userid。我想将它与匿名用户的不完整活动相关联。使用 aspnet_Users 的主键比创建自己的 GUID(我可以这样做并存储在配置文件中)更可取。
这基本上是一个dupe of this question,但这个问题从未真正得到回答。
【问题讨论】:
标签: asp.net-membership anonymous-users