When you browse in petshop without logon, you are holding and using an anonymous user identity. The username of this user identity isGuid string. The user migration method can be used to transform anonymous users into audit users. In fact, the profile and cookie are generated for anonymous users, but the maintained status is stored on the local computer, if the cookie expires or another computer is used, information may be lost.
When in petshopCheck outThen, it will jump to signin. aspx to log on, and then executeGlobal. asaxInProfile Table and cart tableConverts anonymous user information into login user information.
RunGlobal. asaxIn profilemanager. deleteprofile (E. anonymousid); then jump to the following method in petshop. profile. petshopprofileprovider:
Code
Public Override Int Deleteprofiles ( String [] Usernames ){
IntDeletecount= 0;
foreach ( string User in usernames)
If (deleteprofile (User ))
deletecount ++ ;
ReturnDeletecount;
}
Private Static BoolDeleteprofile (StringUsername ){
Checkusername (username );
ReturnDal. deleteprofile (username, applicationname );
}
Run petshop. sqlprofiledal. petshopprofileprovider
Code
Public Bool Deleteprofile ( String Username, String Appname ){
IntUniqueid=Getuniqueid (username,False,True, Appname );
String Sqldelete = " Delete from profiles where uniqueid = @ uniqueid; " ;
Sqlparameter Param = New Sqlparameter ( " @ Uniqueid " , Sqldbtype. Int, 4 );
Param. Value = Uniqueid;
IntNumdeleted=Sqlhelper. executenonquery (sqlhelper. connectionstringprofile, commandtype. Text, sqldelete, Param );
If (Numdeleted <= 0 )
Return False ;
Else
Return True ;
}
Method To delete anonymous users.