Class Link
- Namespace
- Dynamicweb.Mailing.Links
- Assembly
- Dynamicweb.Mailing.dll
Represents link
public class Link
- Inheritance
-
Link
- Inherited Members
Constructors
Link()
Initializes a new instance of the Link class.
public Link()
Fields
LinkAdditionalParametersRequestNamePrefix
public const string LinkAdditionalParametersRequestNamePrefix = "linkparam_"
Field Value
LinkClickerRequestName
public const string LinkClickerRequestName = "ref"
Field Value
LinkHandlerBaseUrl
public const string LinkHandlerBaseUrl = "/link.ashx"
Field Value
LinkIdRequestName
public const string LinkIdRequestName = "id"
Field Value
LinkParseRegex
public const string LinkParseRegex = "(https?:\\/\\/|www)[-A-Za-z0-9+&@#/%?=~_()|!:,.;]*[-A-Za-z0-9+&@#/%=~_()|]"
Field Value
LinkTagRequestNamePrefix
public const string LinkTagRequestNamePrefix = "tag_"
Field Value
Properties
Clicks
Gets the link clicks.
public List<LinkClick> Clicks { get; }
Property Value
Id
Gets the id.
public int Id { get; }
Property Value
IsNew
Gets a value indicating whether this instance is new.
public bool IsNew { get; }
Property Value
- bool
true
if this instance is new; otherwise,false
.
LinkReferenceKey
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.
LinkReferenceType
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.
OriginalUrl
Gets or sets the original URL of the Link.
public string OriginalUrl { get; set; }
Property Value
- string
- The original URL.
Methods
Delete()
Deletes this instance.
public bool Delete()
Returns
- bool
- True if delete operation succeeded
FindTags(string)
public static List<string> FindTags(string url)
Parameters
url
string
Returns
GetLinkById(int)
Gets the link by id.
public static Link GetLinkById(int id)
Parameters
id
int- The id.
Returns
GetLinkHandlerUrl()
Gets the LinkHandler url for this Link.
This url is a relative path, eg. "/Link.ashx?id=xxx".
public string GetLinkHandlerUrl()
Returns
GetLinkHandlerUrl(bool)
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
GetLinksByTypeAndKey(string, string)
Gets the links by type and key.
public static LinkCollection GetLinksByTypeAndKey(string linkType, string linkKey)
Parameters
Returns
ParseAndReplaceAndSaveLinks(bool, string, string, string, string, bool)
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.
Save()
Saves this instance.
public bool Save()
Returns
- bool
- True is save operation succeeded