Problem adding new subscriber

Vote:
 

When I am trying to register a new email address for subscription I get following error: (User i anonymous)

Server Error in '/' Application.

--------------------------------------------------------------------------------


This property cannot be set for anonymous users.


Description:

An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Configuration.Provider.ProviderException: This property cannot be set for anonymous users.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
 

Stack Trace:


[ProviderException: This property cannot be set for anonymous users.]
   System.Web.Profile.ProfileBase.SetInternal(String propertyName, Object value) +2439587
   System.Web.Profile.ProfileBase.set_Item(String propertyName, Object value) +71
   EPiServer.Personalization.EPiServerProfile.set_Item(String propertyName, Object value) +34
   EPiServer.Personalization.EPiServerProfile.set_Email(String value) +14
   Eskilstuna.Externweb.Web.Templates.Public.Units.Placeable.ArticleHeader.Subscribe_Click(Object sender, EventArgs e) +156
   System.Web.UI.WebControls.Button.OnClick(EventArgs e) +111
   System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +110
   System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +10
   System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +13
   System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +36
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1565
 

#49269
Mar 10, 2011 17:06
Vote:
 

What I am trying to do is:

currentUser = EPiServerProfile.Current;
                    //currentUser.Email = email;
                }
                else
                {
                    currentUser = emailUser;
                }
                //EPiServerProfile user = EPiServerProfile.Current;
                currentUser.SubscriptionInfo.Interval = Int32.Parse(Interval.SelectedItem.Value);
                //user.Email = Email.Text;
                currentUser.SubscriptionInfo.SubscribeTo(CurrentPage.PageLink, CurrentPage.LanguageBranch);
                currentUser.Save();

currentUser = EPiServerProfile.Current;
currentUser.Email = email;             

currentUser.SubscriptionInfo.Interval = Int32.Parse(Interval.SelectedItem.Value);                             currentUser.SubscriptionInfo.SubscribeTo(CurrentPage.PageLink, CurrentPage.LanguageBranch);
currentUser.Save();

#49281
Mar 11, 2011 11:16
Vote:
 

This property cannot be set for anonymous users --> The current user is anonymous and thus does not have a user to set subscription info for.

 

#49284
Mar 11, 2011 11:53
Vote:
 

Solution was to allow anonymous users i web.config

#49288
Mar 11, 2011 12:21
Vote:
 

Interesting, didn't know that worked. Care to explain more in detail what you did?

*Edit* Here's a link explaining what to do. Nice to know it's possible :)

http://odetocode.com/articles/440.aspx

#49289
Edited, Mar 11, 2011 12:23
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.