Class Subscription
Handles subscription for the current user through personalization
Inheritance
Inherited Members
Namespace: EPiServer.Personalization
Assembly: EPiServer.dll
Version: 9.12.2Syntax
[Obsolete("The subscription feature is being phased out, it will continue to work but we do not recommend using it for new solutions.")]
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 |
|
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. |