ASP NET Profiles and Application Scope

G

Guest

I have a web app which is set-up to use the SQLProfileProvider model and the
site needs to be deployed in two seperate locations (Site1 & Site2). Now if
the user logs into Site1 a profile will be generated will be created for that
User using the ApplicationName within the provider applicationname. Now if
the user logs into Site2 another profile is created in the db under a new
application "/" which is automatically generated? First of all why is this
new application "/" created automatically and why does it not use the same
application name as the one specified in provide applicationname?

The reason I am curious is because Microsoft states that:

In addition to scoping profile data by user, SqlProfileProvider supports
scoping by application name. Websites that register profile providers with
identical applicationName attributes share profile data, whereas websites
that register profile providers with unique applicationNames do not. Scoping
by user name (or user ID) is facilitated by the user ID recorded with each
set of persisted profile properties, whereas scoping by application name is
facilitated by the application ID accompanying each user ID in the
aspnet_Users table.

So why can't I find my original profile as I created and possibly modified
within Site1. It generates a completely seperate profile???????? i tried
generating code to copy the profiles over but seems to be very tempremental.
Debugging works some times and running in deployment never works? I deployed
the sites with two seperate application names Site1 and Site2

private void Update(ProfileBase newProfile, string userName)
{
Profilebase oldProfile;
string site2AppName;

//get the provider
SqlProfileProvider provider =
(SqlProfileProvider)client.Providers["ProfileProvider"];

//get the current web application name;
site2AppName = provider.ApplicationName

//change the application name over so we can search
//through that application branch
provider.ApplicationName = Site1AppName; (from Somewhere)

//get a hold of the old profile
oldProfile = newProfile.GetProfile(userName);

//get the collection of properties
SettingsPropertyValueCollection profileProperties =
oldProfile.PropertyValues;

//set application back to original app
provider.ApplicationName = site2AppName;

provider.SetPropertyValues(newProfile.Context, profileProperties);

//save profile
newProfile.Save();

}

So, after all that what am I doing wrong?????
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,904
Latest member
HealthyVisionsCBDPrice

Latest Threads

Top