C# Class Subtext.Framework.Format.UrlFormats

Default Implemenation of UrlFormats
Afficher le fichier Open project: ayende/Subtext Class Usage Examples

Protected Properties

Свойство Type Description
fullyQualifiedUrl string

Méthodes publiques

Méthode Description
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

Méthodes protégées

Méthode Description
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.

Private Methods

Méthode Description
EntryUrl ( int entryId, string entryName, System.DateTime entryDate ) : string

Method Details

AdminUrl() public méthode

public AdminUrl ( string Page ) : string
Page string
Résultat string

AggBugkUrl() public méthode

public AggBugkUrl ( int EntryID ) : string
EntryID int
Résultat string

ArticleCategoryUrl() public méthode

public ArticleCategoryUrl ( string categoryName, int categoryID ) : string
categoryName string
categoryID int
Résultat string

ArticleUrl() public méthode

public ArticleUrl ( Entry entry ) : string
entry Subtext.Framework.Components.Entry
Résultat string

CommentApiUrl() public méthode

public CommentApiUrl ( int entryId ) : string
entryId int
Résultat string

CommentRssUrl() public méthode

public CommentRssUrl ( int entryId ) : string
entryId int
Résultat string

DateFromUrl() public static méthode

Returns a DateTime instance parsed from the url.
public static DateFromUrl ( string url ) : System.DateTime
url string URL.
Résultat System.DateTime

DayUrl() public méthode

public DayUrl ( System.DateTime dt ) : string
dt System.DateTime
Résultat string

EntryFullyQualifiedUrl() public méthode

public EntryFullyQualifiedUrl ( System.DateTime entryDate, string entryID ) : string
entryDate System.DateTime
entryID string
Résultat string

EntryFullyQualifiedUrl() public méthode

public EntryFullyQualifiedUrl ( System.DateTime entryDate, string entryName, int entryId ) : string
entryDate System.DateTime
entryName string
entryId int
Résultat string

EntryFullyQualifiedUrl() public méthode

public EntryFullyQualifiedUrl ( Entry entry ) : string
entry Subtext.Framework.Components.Entry
Résultat string

EntryUrl() public méthode

Returns a relative URL to the entry.
public EntryUrl ( Entry entry ) : string
entry Subtext.Framework.Components.Entry The entry.
Résultat string

FeedbackFullyQualifiedUrl() public méthode

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.
Résultat System.Uri

FeedbackUrl() public méthode

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.
Résultat string

GalleryUrl() public méthode

public GalleryUrl ( string category, int GalleryID ) : string
category string
GalleryID int
Résultat string

GetBlogSubfolderFromRequest() public static méthode

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.
Résultat string

GetEditLink() public static méthode

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
Résultat string

GetFeedbackEditLink() public static méthode

public static GetFeedbackEditLink ( FeedbackItem feedback ) : string
feedback Subtext.Framework.Components.FeedbackItem
Résultat string

GetFullyQualifiedUrl() protected méthode

Returns a fully qualified Url using the specified format string.
protected GetFullyQualifiedUrl ( string formatString ) : string
formatString string The pattern.
Résultat string

GetHostFromExternalUrl() public static méthode

Parses out the host from an external URL.
public static GetHostFromExternalUrl ( string url ) : string
url string The URL.
Résultat string

GetImageFullUrl() public static méthode

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
Résultat string

GetPostIDFromUrl() public static méthode

Parses out the post ID from URL.
public static GetPostIDFromUrl ( string uri ) : int
uri string The URI.
Résultat int

GetRequestedFileName() public static méthode

Gets the name of the requested file.
public static GetRequestedFileName ( string uri ) : string
uri string The URI.
Résultat string

GetUriReferrerSafe() public static méthode

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
Résultat System.Uri

GetUrl() protected méthode

Returns a fully qualified Url using the specified format string.
protected GetUrl ( string formatString ) : string
formatString string The pattern.
Résultat string

ImageUrl() public méthode

public ImageUrl ( string category, int ImageID ) : string
category string
ImageID int
Résultat string

IsInDirectory() public static méthode

Determines whether the current request is in the specified directory.
public static IsInDirectory ( String rootFolderName ) : bool
rootFolderName String Name of the root folder.
Résultat bool

IsInSpecialDirectory() public static méthode

Determines whether the current request is a request within a special directory.
public static IsInSpecialDirectory ( string folderName ) : bool
folderName string Name of the folder.
Résultat bool

MonthUrl() public méthode

public MonthUrl ( System.DateTime dt ) : string
dt System.DateTime
Résultat string

PostCategoryUrl() public méthode

public PostCategoryUrl ( string categoryName, int categoryID ) : string
categoryName string
categoryID int
Résultat string

ResolveLinks() public static méthode

public static ResolveLinks ( string body ) : string
body string
Résultat string

ShortenUrl() public static méthode

public static ShortenUrl ( string url, int max ) : string
url string
max int
Résultat string

StripHostFromUrl() public static méthode

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
Résultat string

StripSurroundingSlashes() public static méthode

Strips the surrounding slashes from the specified string.
public static StripSurroundingSlashes ( string target ) : string
target string The target.
Résultat string

TrackBackUrl() public méthode

public TrackBackUrl ( int entryId ) : string
entryId int
Résultat string

UrlFormats() public méthode

public UrlFormats ( Uri fullyQualifiedUrl ) : System
fullyQualifiedUrl System.Uri
Résultat System

YearUrl() public méthode

public YearUrl ( System.DateTime dt ) : string
dt System.DateTime
Résultat string

Property Details

fullyQualifiedUrl protected_oe property

protected string fullyQualifiedUrl
Résultat string