I have a global.asax file in an ASP.NET web application, and I want to add the event handler for migrating anonymous profiles. Here is the code:
using System;
using BCC.Data;
using System.Web;
using System.Web.Profile;
using System.Web.Security;
namespace BCC {
public class Global : System.Web.HttpApplication {
protected void Session_Start ( object sender, EventArgs e ) {
if ((string)Request.QueryString["rc"] != null) {
var code = (string)Request.QueryString["rc"];
if ( ReferralMemberDB.ValidateCode ( code ) )
Session ["RCode"] = code;
else
Session ["RCode"] = null;
}
}
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;
ProfileManager.DeleteProfile ( args.AnonymousID );
AnonymousIdentificationModule.ClearAnonymousIdentifier ( );
Membership.DeleteUser ( args.AnonymousID, true );
}
}
}
For whatever reason, I get the error that the type or namespace for ProfileCommon can't be found, even though I'm including references to System.Web.Security and and System.Web.Profile. Any help with what's going on?