C# Класс Subtext.Framework.Format.UrlFormats

Default Implemenation of UrlFormats
Показать файл Открыть проект Примеры использования класса

Защищенные свойства (Protected)

Свойство Тип Описание
fullyQualifiedUrl string

Открытые методы

Метод Описание
AdminUrl ( string Page ) : string
AggBugkUrl ( int EntryID ) : string
ArticleCategoryUrl ( string categoryName, int categoryID ) : string
ArticleUrl ( Entry entry ) : string
CommentApiUrl ( int entryId ) : string
CommentRssUrl ( int entryId ) : string
DateFromUrl ( string url ) : System.DateTime

Returns a DateTime instance parsed from the url.

DayUrl ( System.DateTime dt ) : string
EntryFullyQualifiedUrl ( System.DateTime entryDate, string entryID ) : string
EntryFullyQualifiedUrl ( System.DateTime entryDate, string entryName, int entryId ) : string
EntryFullyQualifiedUrl ( Entry entry ) : string
EntryUrl ( Entry entry ) : string

Returns a relative URL to the entry.

FeedbackFullyQualifiedUrl ( int parentId, string parentEntryName, System.DateTime parentCreateDate, FeedbackItem feedback ) : Uri

Returns the fully URL to the specified feedback item.

FeedbackUrl ( int parentId, string parentEntryName, System.DateTime parentCreateDate, FeedbackItem feedback ) : string

Returns the URL to the specified feedback item.

GalleryUrl ( string category, int GalleryID ) : string
GetBlogSubfolderFromRequest ( string rawUrl, string applicationPath ) : string

Parses out the subfolder of the blog from the requested URL. It simply searches for the first "folder" after the host and Request.ApplicationPath.

For example, if a blog is hosted at the virtual directory http://localhost/Subtext.Web/ and request is made for http://localhost/Subtext.Web/, the subfolder name is "" (empty string). Howver, a request for http://localhost/Subtext.Web/MyBlog/ would return "MyBlog" as the subfolder.

Likewise, if a blog is hosted at http://localhost/, a request for http://localhost/MyBlog/ would return "MyBlog" as the subfolder.

GetEditLink ( Entry entry ) : string

Builds the HyperLink.NavigateUrl for an EditPost Link by determining the current Subfolder and adding it to the URL if necessary.

GetFeedbackEditLink ( FeedbackItem feedback ) : string
GetHostFromExternalUrl ( string url ) : string

Parses out the host from an external URL.

GetImageFullUrl ( string imageUrl ) : string

Get the fully qualified url for an image for a given url to the image. The given url could be fully qualified, or some type of local url.

GetPostIDFromUrl ( string uri ) : int

Parses out the post ID from URL.

GetRequestedFileName ( string uri ) : string

Gets the name of the requested file.

GetUriReferrerSafe ( HttpRequest request ) : Uri

From Jason Block @ http://www.angrycoder.com/article.aspx?cid=5&y=2003&m=4&d=15 Basically, it's [Request.UrlReferrer] doing a lazy initialization of its internal _referrer field, which is a Uri-type class. That is, it's not created until it's needed. The point is that there are a couple of spots where the UriFormatException could leak through. One is in the call to GetKnownRequestHeader(). _wr is a field of type HttpWorkerRequest. 36 is the value of the HeaderReferer constant - since that's being blocked in this case, it may cause that exception to occur. However, HttpWorkerRequest is an abstract class, and it took a trip to the debugger to find out that _wr is set to a System.Web.Hosting.ISAPIWorkerRequestOutOfProc object. This descends from System.Web.Hosting.ISAPIWorkerRequest, and its implementation of GetKnownRequestHeader() didn't seem to be the source of the problem.

ImageUrl ( string category, int ImageID ) : string
IsInDirectory ( String rootFolderName ) : bool

Determines whether the current request is in the specified directory.

IsInSpecialDirectory ( string folderName ) : bool

Determines whether the current request is a request within a special directory.

MonthUrl ( System.DateTime dt ) : string
PostCategoryUrl ( string categoryName, int categoryID ) : string
ResolveLinks ( string body ) : string
ShortenUrl ( string url, int max ) : string
StripHostFromUrl ( string url ) : string

Return the url with the http://host stripped off the front. The given url may or maynot have the http://host on it.

StripSurroundingSlashes ( string target ) : string

Strips the surrounding slashes from the specified string.

TrackBackUrl ( int entryId ) : string
UrlFormats ( Uri fullyQualifiedUrl ) : System
YearUrl ( System.DateTime dt ) : string

Защищенные методы

Метод Описание
GetFullyQualifiedUrl ( string formatString ) : string

Returns a fully qualified Url using the specified format string.

GetUrl ( string formatString ) : string

Returns a fully qualified Url using the specified format string.

Приватные методы

Метод Описание
EntryUrl ( int entryId, string entryName, System.DateTime entryDate ) : string

Описание методов

AdminUrl() публичный Метод

public AdminUrl ( string Page ) : string
Page string
Результат string

AggBugkUrl() публичный Метод

public AggBugkUrl ( int EntryID ) : string
EntryID int
Результат string

ArticleCategoryUrl() публичный Метод

public ArticleCategoryUrl ( string categoryName, int categoryID ) : string
categoryName string
categoryID int
Результат string

ArticleUrl() публичный Метод

public ArticleUrl ( Entry entry ) : string
entry Subtext.Framework.Components.Entry
Результат string

CommentApiUrl() публичный Метод

public CommentApiUrl ( int entryId ) : string
entryId int
Результат string

CommentRssUrl() публичный Метод

public CommentRssUrl ( int entryId ) : string
entryId int
Результат string

DateFromUrl() публичный статический Метод

Returns a DateTime instance parsed from the url.
public static DateFromUrl ( string url ) : System.DateTime
url string URL.
Результат System.DateTime

DayUrl() публичный Метод

public DayUrl ( System.DateTime dt ) : string
dt System.DateTime
Результат string

EntryFullyQualifiedUrl() публичный Метод

public EntryFullyQualifiedUrl ( System.DateTime entryDate, string entryID ) : string
entryDate System.DateTime
entryID string
Результат string

EntryFullyQualifiedUrl() публичный Метод

public EntryFullyQualifiedUrl ( System.DateTime entryDate, string entryName, int entryId ) : string
entryDate System.DateTime
entryName string
entryId int
Результат string

EntryFullyQualifiedUrl() публичный Метод

public EntryFullyQualifiedUrl ( Entry entry ) : string
entry Subtext.Framework.Components.Entry
Результат string

EntryUrl() публичный Метод

Returns a relative URL to the entry.
public EntryUrl ( Entry entry ) : string
entry Subtext.Framework.Components.Entry The entry.
Результат string

FeedbackFullyQualifiedUrl() публичный Метод

Returns the fully URL to the specified feedback item.
public FeedbackFullyQualifiedUrl ( int parentId, string parentEntryName, System.DateTime parentCreateDate, FeedbackItem feedback ) : Uri
parentId int The id of the parent entry.
parentEntryName string If exists.
parentCreateDate System.DateTime
feedback Subtext.Framework.Components.FeedbackItem The feedback.
Результат System.Uri

FeedbackUrl() публичный Метод

Returns the URL to the specified feedback item.
public FeedbackUrl ( int parentId, string parentEntryName, System.DateTime parentCreateDate, FeedbackItem feedback ) : string
parentId int The id of the parent entry.
parentEntryName string If exists.
parentCreateDate System.DateTime
feedback Subtext.Framework.Components.FeedbackItem The feedback.
Результат string

GalleryUrl() публичный Метод

public GalleryUrl ( string category, int GalleryID ) : string
category string
GalleryID int
Результат string

GetBlogSubfolderFromRequest() публичный статический Метод

Parses out the subfolder of the blog from the requested URL. It simply searches for the first "folder" after the host and Request.ApplicationPath.

For example, if a blog is hosted at the virtual directory http://localhost/Subtext.Web/ and request is made for http://localhost/Subtext.Web/, the subfolder name is "" (empty string). Howver, a request for http://localhost/Subtext.Web/MyBlog/ would return "MyBlog" as the subfolder.

Likewise, if a blog is hosted at http://localhost/, a request for http://localhost/MyBlog/ would return "MyBlog" as the subfolder.

public static GetBlogSubfolderFromRequest ( string rawUrl, string applicationPath ) : string
rawUrl string The raw url.
applicationPath string The virtual application name as found in the Request.ApplicationName property.
Результат string

GetEditLink() публичный статический Метод

Builds the HyperLink.NavigateUrl for an EditPost Link by determining the current Subfolder and adding it to the URL if necessary.
public static GetEditLink ( Entry entry ) : string
entry Subtext.Framework.Components.Entry The entry to be edited
Результат string

GetFeedbackEditLink() публичный статический Метод

public static GetFeedbackEditLink ( FeedbackItem feedback ) : string
feedback Subtext.Framework.Components.FeedbackItem
Результат string

GetFullyQualifiedUrl() защищенный Метод

Returns a fully qualified Url using the specified format string.
protected GetFullyQualifiedUrl ( string formatString ) : string
formatString string The pattern.
Результат string

GetHostFromExternalUrl() публичный статический Метод

Parses out the host from an external URL.
public static GetHostFromExternalUrl ( string url ) : string
url string The URL.
Результат string

GetImageFullUrl() публичный статический Метод

Get the fully qualified url for an image for a given url to the image. The given url could be fully qualified, or some type of local url.
public static GetImageFullUrl ( string imageUrl ) : string
imageUrl string url to an image
Результат string

GetPostIDFromUrl() публичный статический Метод

Parses out the post ID from URL.
public static GetPostIDFromUrl ( string uri ) : int
uri string The URI.
Результат int

GetRequestedFileName() публичный статический Метод

Gets the name of the requested file.
public static GetRequestedFileName ( string uri ) : string
uri string The URI.
Результат string

GetUriReferrerSafe() публичный статический Метод

From Jason Block @ http://www.angrycoder.com/article.aspx?cid=5&y=2003&m=4&d=15 Basically, it's [Request.UrlReferrer] doing a lazy initialization of its internal _referrer field, which is a Uri-type class. That is, it's not created until it's needed. The point is that there are a couple of spots where the UriFormatException could leak through. One is in the call to GetKnownRequestHeader(). _wr is a field of type HttpWorkerRequest. 36 is the value of the HeaderReferer constant - since that's being blocked in this case, it may cause that exception to occur. However, HttpWorkerRequest is an abstract class, and it took a trip to the debugger to find out that _wr is set to a System.Web.Hosting.ISAPIWorkerRequestOutOfProc object. This descends from System.Web.Hosting.ISAPIWorkerRequest, and its implementation of GetKnownRequestHeader() didn't seem to be the source of the problem.
public static GetUriReferrerSafe ( HttpRequest request ) : Uri
request System.Web.HttpRequest
Результат System.Uri

GetUrl() защищенный Метод

Returns a fully qualified Url using the specified format string.
protected GetUrl ( string formatString ) : string
formatString string The pattern.
Результат string

ImageUrl() публичный Метод

public ImageUrl ( string category, int ImageID ) : string
category string
ImageID int
Результат string

IsInDirectory() публичный статический Метод

Determines whether the current request is in the specified directory.
public static IsInDirectory ( String rootFolderName ) : bool
rootFolderName String Name of the root folder.
Результат bool

IsInSpecialDirectory() публичный статический Метод

Determines whether the current request is a request within a special directory.
public static IsInSpecialDirectory ( string folderName ) : bool
folderName string Name of the folder.
Результат bool

MonthUrl() публичный Метод

public MonthUrl ( System.DateTime dt ) : string
dt System.DateTime
Результат string

PostCategoryUrl() публичный Метод

public PostCategoryUrl ( string categoryName, int categoryID ) : string
categoryName string
categoryID int
Результат string

ResolveLinks() публичный статический Метод

public static ResolveLinks ( string body ) : string
body string
Результат string

ShortenUrl() публичный статический Метод

public static ShortenUrl ( string url, int max ) : string
url string
max int
Результат string

StripHostFromUrl() публичный статический Метод

Return the url with the http://host stripped off the front. The given url may or maynot have the http://host on it.
public static StripHostFromUrl ( string url ) : string
url string
Результат string

StripSurroundingSlashes() публичный статический Метод

Strips the surrounding slashes from the specified string.
public static StripSurroundingSlashes ( string target ) : string
target string The target.
Результат string

TrackBackUrl() публичный Метод

public TrackBackUrl ( int entryId ) : string
entryId int
Результат string

UrlFormats() публичный Метод

public UrlFormats ( Uri fullyQualifiedUrl ) : System
fullyQualifiedUrl System.Uri
Результат System

YearUrl() публичный Метод

public YearUrl ( System.DateTime dt ) : string
dt System.DateTime
Результат string

Описание свойств

fullyQualifiedUrl защищенное свойство

protected string fullyQualifiedUrl
Результат string