0

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?

RiverNet
  • 121
  • 1
  • 6
  • Possible duplicate of: https://stackoverflow.com/questions/1584507/web-application-project-how-to-use-profilecommon – JustAnotherDev May 30 '21 at 22:12
  • @justanotherdev-This isn't a duplicate. I am using Profile elsewhere in the site without issue. I deleted and recreated global.asax, and it's the only place where the error occurs. Not sure why... – RiverNet May 30 '21 at 23:52

0 Answers0