Developer forum

Forum » CMS - Standard features » Error when unsubscribing a user

Error when unsubscribing a user

Imar Spaanjaars Dynamicweb Employee
Imar Spaanjaars
Reply

Hi there,

When a newsletter subscriber tries to unsubscribe, we get the following error:

System.Exception: Username must have a nonempty value

Generated: Fri, 28 Aug 2015 02:32:19 GMT

System.Web.HttpUnhandledException (0x80004005): Exception of type 'System.Web.HttpUnhandledException' was thrown. ---> System.Exception: Username must have a nonempty value
   at Dynamicweb.Modules.UserManagement.User.Save()
   at Dynamicweb.Modules.EmailMarketing.RecipientProviders.AccessUserRecipientProvider.UnsubscribeRecipient(Recipient recipient)
   at Dynamicweb.Admin.Unsubscribe.OnUnsubscribeRecipient()
   at Dynamicweb.Admin.Unsubscribe.Page_Load(Object sender, EventArgs e)
   at System.Web.UI.Control.LoadRecursive()
   at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
   at System.Web.UI.Page.HandleError(Exception e)
   at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
   at System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
   at System.Web.UI.Page.ProcessRequest()
   at System.Web.UI.Page.ProcessRequest(HttpContext context)
   at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
   at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
		

The reason fo this error is that the subscriber indeed doesn't have a user name in the AccessUser table. When I update the AccessUserUserName with the user's email address, unsubscribing works fine.

Is this a bug in the unsubscribe functionality? Or an issue with registering new subscribers?

Imar


Replies

 
Imar Spaanjaars Dynamicweb Employee
Imar Spaanjaars
Reply

Bump. Anyone? I'd like to resolve this as currently subscribers that aren't users can't unsubscribe....

 
Scott Forsyth
Reply

I assume that some sort of unique primary key needs to be assigned to AccessUsers. So, could you resolve this by setting the username to a unique value, like a guid? I do that with some situations like this. If I don't use the email address for the username, I assign it a guid so that it's unique and so that something is set for the username. That seems to keep everything happy.

 
Imar Spaanjaars Dynamicweb Employee
Imar Spaanjaars
Reply

Yeah, I updated all users without a user name and assigned their email address as their user name.

However, I am trying to figure out if it's a bug in Dynamicweb that causes the code to crash when no user name exists. We turned out to have hundreds of unsubscribe attempts that all failed because the user name was missing so if it's an issue in DW, I rather get it solved for good than manually updating the database from time to time.

Imar

 

 
Nicolai Høeg Pedersen
Reply

Hi Imar

It is because the user does not have a username as you figured out. Users must have a username.

It is known as TFS#16086 which was rejected... I think there are some other potential issues if we do not have a username on the user record.

BR Nicolai

 

You must be logged in to post in the forum