我正在创建一个Asp.NET MVC-4应用程序。在我的应用程序中,用户可以发布他们的产品。我希望,无论用户登录或不匿名,他可以张贴那里的产品。为此,我可以使用SessionId,但我担心如果会话过期,我如何检测匿名用户。
我想知道如何将匿名配置文件迁移到已登录的用户配置文件。请建议我一些好的教程或资源或逻辑,我可以实现这一点。
发布于 2013-08-08 15:25:34
http://msdn.microsoft.com/en-us/library/ewfkf772(v=vs.100).aspx拥有一切。
使用此选项可在Global.asax中迁移rhe配置文件
public void Profile_OnMigrateAnonymous(object sender, ProfileMigrateEventArgs args)
{
ProfileCommon anonymousProfile = Profile.GetProfile(args.AnonymousID);
Profile.ZipCode = anonymousProfile.ZipCode;
Profile.CityAndState = anonymousProfile.CityAndState;
Profile.StockSymbols = anonymousProfile.StockSymbols;
////////
// Delete the anonymous profile. If the anonymous ID is not
// needed in the rest of the site, remove the anonymous cookie.
ProfileManager.DeleteProfile(args.AnonymousID);
AnonymousIdentificationModule.ClearAnonymousIdentifier();
// Delete the user row that was created for the anonymous user.
Membership.DeleteUser(args.AnonymousID, true);
}https://stackoverflow.com/questions/18119728
复制相似问题