Table of Contents

Class Link

Namespace
Dynamicweb.Mailing.Links
Assembly
Dynamicweb.Core.dll

Represents link

public class Link
Inheritance
Link
Inherited Members

Constructors

Initializes a new instance of the Link class.

public Link()

Fields

public const string LinkAdditionalParametersRequestNamePrefix = "linkparam_"

Field Value

string
public const string LinkClickerRequestName = "ref"

Field Value

string
public const string LinkHandlerBaseUrl = "/link.ashx"

Field Value

string
public const string LinkIdRequestName = "id"

Field Value

string
public const string LinkParseRegex = "(https?:\\/\\/|www)[-A-Za-z0-9+&@#/%?=~_()|!:,.;]*[-A-Za-z0-9+&@#/%=~_()|]"

Field Value

string
public const string LinkTagRequestNamePrefix = "tag_"

Field Value

string

Properties

Gets the link clicks.

public List<LinkClick> Clicks { get; }

Property Value

List<LinkClick>

Gets the id.

public int Id { get; }

Property Value

int

Gets a value indicating whether this instance is new.

public bool IsNew { get; }

Property Value

bool

true if this instance is new; otherwise, false.

Gets or sets the link reference key. This value is a unique identifier to determine to where the Link belongs.

public string? LinkReferenceKey { get; set; }

Property Value

string

The link reference key.

Gets or sets the type of the link reference. This value is a unique identifier to determine to where the Link belongs.

public string? LinkReferenceType { get; set; }

Property Value

string

The type of the link reference.

Gets or sets the original URL of the Link.

public string OriginalUrl { get; set; }

Property Value

string

The original URL.

Methods

Deletes this instance.

public bool Delete()

Returns

bool

True if delete operation succeeded

public static List<string> FindTags(string url)

Parameters

url string

Returns

List<string>

Gets the link by id.

public static Link GetLinkById(int id)

Parameters

id int

The id.

Returns

Link

Gets the LinkHandler url for this Link. This url is a relative path, eg. "/Link.ashx?id=xxx".

public string GetLinkHandlerUrl()

Returns

string

Gets link handler url

public string GetLinkHandlerUrl(bool isParseLink)

Parameters

isParseLink bool

If True then uses link handler base url value

Returns

string

Parsed link url

Gets the link url by id.

public static Uri? GetLinkOriginalUrl(int id)

Parameters

id int

The link id.

Returns

Uri

Gets the links by type and key.

public static LinkCollection GetLinksByTypeAndKey(string linkType, string linkKey)

Parameters

linkType string

Type of the link.

linkKey string

The link key.

Returns

LinkCollection

Parses all link elements in a given text that match the LinkParseRegex and creates and saves then as Link objects.

public static Tuple<string, LinkCollection> ParseAndReplaceAndSaveLinks(bool saveLinks, string text, string referenceKey, string referenceType, string linkDomain, bool isParseLink = false)

Parameters

saveLinks bool

Indicates, need to save the links or not

text string

The text to find and replace links in.

referenceKey string

The reference key to add to the links.

referenceType string

The reference type to add to the links.

linkDomain string

The link domain

isParseLink bool

Indicates, need to parse link or not

Returns

Tuple<string, LinkCollection>

A combination of the replaced string and all links found.

Saves this instance.

public bool Save()

Returns

bool

True is save operation succeeded

To top