an ASP.NET Open Source CMS & eCommerce platform
Search:
Last Post 5/7/2010 11:00:59 AM By Bahram. 6 replies.
5/5/2010 1:53:48 PM
Bahram
Posts: 878
Joined: 12/8/2008
Location:Vancouver, BC Canada
Delete a user in Code
This is my code for deleting a user, The membership and aspnet tables are deleted, but the user tables not.                
 
MembershipUser m = Membership.GetUser(userName);
Membership.DeleteUser(userName, true);
DSC.User.Delete(userName);
 
 
Does DCS,User.Delete checks for all other entry of this user, How can we find why it could not delete a user. there is no return value.
5/5/2010 10:30:10 PM
lukezy
Posts: 2109
Joined: 6/12/2007
Location:WA, US
Re: Delete a user in Code
Catch exception.
DotShoppingCart Staff
5/6/2010 1:13:00 PM
Bahram
Posts: 878
Joined: 12/8/2008
Location:Vancouver, BC Canada
Re: Delete a user in Code
This is the exception :

An exception occurred deleting DSC user. Could not load file or assembly 'Microsoft.Practices.EnterpriseLibrary.Data, Version=4.1.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.

 
5/6/2010 1:52:22 PM
Bahram
Posts: 878
Joined: 12/8/2008
Location:Vancouver, BC Canada
Re: Delete a user in Code
Hi Luke,
 
Actually i wrapped all DML operations in a class libarary called UserHandler. and copied the UserHandler.dll to \bin folder of my Site.
It seems I need a web.config or UserHandler.config for this dll. Is that what I need to do.
5/6/2010 4:51:29 PM
lukezy
Posts: 2109
Joined: 6/12/2007
Location:WA, US
Re: Delete a user in Code
The error message says you are missing Microsoft.Practices.EnterpriseLibrary.Data.dll.
DotShoppingCart Staff
5/7/2010 9:32:53 AM
Bahram
Posts: 878
Joined: 12/8/2008
Location:Vancouver, BC Canada
Re: Delete a user in Code
No,  that dll is in the references. My Question is how a class library can have config file. what should the name of that config file be? 
5/7/2010 11:00:59 AM
Bahram
Posts: 878
Joined: 12/8/2008
Location:Vancouver, BC Canada
Re: Delete a user in Code
I unified the Bin folder of Website and the Class library , so I got this message :
 

An exception occurred deleting DSC user. Could not load file or assembly 'Microsoft.Practices.EnterpriseLibrary.Data, Version=4.1.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies.

The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)