我想從匿名用戶獲得aspnet成員資格UserId
字段。如何獲取ASP.NET成員中的匿名用戶的aspnet_Users.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: [email protected]
我只需要找到如何獲得'Userid'值。
這是不可能使用:
Membership.Provider.GetUser(Request.AnonymousID, false);
的Request.AnonymousID是不同的GUID和不等於36139818-4245-45dd-99cb-2a721d43f9c5。
有什麼辦法可以得到這個Userid。我想將它與匿名用戶的不完整活動相關聯。使用aspnet_Users
的主鍵比創建我自己的GUID(我可以在配置文件中存儲)要好。
這基本上是一個dupe of this question但這個問題從來沒有真正的答案。
奇怪。不知道我是如何錯過的。謝謝 – 2010-05-15 18:19:06