Interface IPreviewService
Provides functionality for managing content preview mode.
Namespace: Umbraco.Cms.Core.Services
Assembly: Umbraco.Core.dll
Syntax
public interface IPreviewService
Remarks
Preview mode allows backoffice users to view unpublished content changes as they would appear on the front-end website.
Methods
View SourceEndPreviewAsync()
Exits preview mode for the current request.
Declaration
Task EndPreviewAsync()
Returns
| Type | Description |
|---|---|
| Task | A task representing the asynchronous operation. |
IsInPreview()
Determines whether the current request is in preview mode.
Declaration
bool IsInPreview()
Returns
| Type | Description |
|---|---|
| bool |
|
TryEnterPreviewAsync(IUser)
Enters preview mode for a given user.
Declaration
Task<bool> TryEnterPreviewAsync(IUser user)
Parameters
| Type | Name | Description |
|---|---|---|
| IUser | user | The user entering preview mode. |
Returns
| Type | Description |
|---|---|
| Task<bool> |
|
TryGetPreviewClaimsIdentityAsync()
Attempts to get the claims identity for the current preview session.
Declaration
Task<Attempt<ClaimsIdentity>> TryGetPreviewClaimsIdentityAsync()
Returns
| Type | Description |
|---|---|
| Task<Attempt<ClaimsIdentity>> | An attempt containing the claims identity if in preview mode; otherwise, a failed attempt. |