November Happy Hour will be moved to Thursday December 5th.

Class Subscription

Handles subscription for the current user through personalization

Inheritance
System.Object
Subscription
Inherited Members
System.Object.ToString()
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
Namespace: EPiServer.Personalization
Assembly: EPiServer.Cms.AspNet.dll
Version: 11.20.7
Syntax
[Obsolete("The subscription feature was obsoleted in CMS 7.5 and is being phased out")]
public class Subscription
Remarks

Subscription stores the state as SubscriptionInfo in the personalized EPiServerProfile object

This class uses internally the SubscriptionInfo class that support reading subscription information from a arbitrary user but passes in the currently online cached user.

Examples

Adds a subscription for a user

            if (Subscription.IsSubscribingTo(CurrentPageLink))
    Response.Write("User is already subscribing");
else
{
    Subscription.SubscribeTo(CurrentPageLink);
    Response.Write("Subscription addedd");
}

Properties

Interval

Set or get interval in days for which subscriptions will be generated

Declaration
public static int Interval { get; set; }
Property Value
Type Description
System.Int32

Methods

CanSubscribeTo(PageReference)

Check if current user can subscribe to this page

Declaration
public static bool CanSubscribeTo(PageReference pageLink)
Parameters
Type Name Description
PageReference pageLink
Returns
Type Description
System.Boolean
Remarks

Checks that user is logged in and that page has enabled support for subscriptions

IsSubscribingTo(PageReference)

Check if current user is subscribing to a page

Declaration
public static bool IsSubscribingTo(PageReference pageLink)
Parameters
Type Name Description
PageReference pageLink

The page to check subscription for

Returns
Type Description
System.Boolean

IsSubscribingTo(PageReference, String)

Check if current user is subscribing to a page

Declaration
public static bool IsSubscribingTo(PageReference pageLink, string language)
Parameters
Type Name Description
PageReference pageLink

The page to check subscription for

System.String language

The language.

Returns
Type Description
System.Boolean

true if the current user is subscribing to the specified page link for the given language; otherwise, false.

ListSubscriptions()

List all pages that the current user subscribes to

Declaration
public static PageReference[] ListSubscriptions()
Returns
Type Description
PageReference[]

SubscribeTo(PageReference)

Subscribe to a page

Declaration
public static void SubscribeTo(PageReference pageLink)
Parameters
Type Name Description
PageReference pageLink

The page to add subscription for

SubscribeTo(PageReference, String)

Subscribe to a page for a specific language

Declaration
public static void SubscribeTo(PageReference pageLink, string language)
Parameters
Type Name Description
PageReference pageLink

The page to add subscription for

System.String language

The language.

UnSubscribe(PageReference)

Unsubscribe to a page

Declaration
public static void UnSubscribe(PageReference pageLink)
Parameters
Type Name Description
PageReference pageLink

The page to remove subscription for

UnSubscribe(PageReference, String)

Unsubscribe to a page for a specific language

Declaration
public static void UnSubscribe(PageReference pageLink, string language)
Parameters
Type Name Description
PageReference pageLink

The page to remove subscription for

System.String language

The language.

Extension Methods