在我的Web.config中,我有如下匿名ID设置:
<anonymousIdentification enabled="true" cookieless="AutoDetect" />
我的个人资料部分设置如下:
<profile defaultProvider="SqlProvider" enabled="true" inherits="QA_Web_Tools.UserProfile">
<providers>
<clear />
<add connectionStringName="QAToolsConnectionString" name="SqlProvider"
type="System.Web.Profile.SqlProfileProvider" />
</providers>
</profile>
public class UserProfile : ProfileBase
{
public static UserProfile GetUserProfile(string username)
{
return Create(username) as UserProfile;
}
public static UserProfile GetUserProfile()
{
return Create(Membership.GetUser().UserName) as UserProfile;
}
[SettingsAllowAnonymous(true)]
public string FullName
{
get { return base["FullName"] as string; }
set { base["FullName"] = value; }
}
[SettingsAllowAnonymous(true)]
public string BuildEmail
{
get { return base["BuildEmail"] as string; }
set { base["BuildEvmail"] = value; }
}
}
this reference
.
GetUserProfile()
方法,因为如果用户是匿名的,
Membership.GetUser()
为空。我可以把匿名身份令牌传给第一个
GetUserProfile(string username)
有人知道如何获得这些信息吗?谷歌似乎没有返回有用的结果。