AI OnAI Off
What I am trying to do is:
currentUser = EPiServerProfile.Current;
currentUser.Email = email;
currentUser.SubscriptionInfo.Interval = Int32.Parse(Interval.SelectedItem.Value); currentUser.SubscriptionInfo.SubscribeTo(CurrentPage.PageLink, CurrentPage.LanguageBranch);
currentUser.Save();
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.
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 :)
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