本文整理匯總了C#中N2.Web.Url.RemoveDefaultDocument方法的典型用法代碼示例。如果您正苦於以下問題:C# Url.RemoveDefaultDocument方法的具體用法?C# Url.RemoveDefaultDocument怎麽用?C# Url.RemoveDefaultDocument使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類N2.Web.Url
的用法示例。
在下文中一共展示了Url.RemoveDefaultDocument方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: ResolveUrl
public virtual PathData ResolveUrl(Url url)
{
try
{
var path = parser.FindPath(url.RemoveDefaultDocument(Url.DefaultDocument).RemoveExtension(observedExtensions));
path.CurrentItem = path.CurrentPage;
if (draftRepository.Versions.TryParseVersion(url[PathData.VersionIndexQueryKey], url[PathData.VersionKeyQueryKey], path))
return path;
string viewPreferenceParameter = url.GetQuery(WebExtensions.ViewPreferenceQueryString);
if (viewPreferenceParameter == WebExtensions.DraftQueryValue && draftRepository.HasDraft(path.CurrentItem))
{
var draft = draftRepository.Versions.GetVersion(path.CurrentPage);
path.TryApplyVersion(draft, url["versionKey"], draftRepository.Versions);
}
return path;
}
catch (Exception ex)
{
errorHandler.Notify(ex);
}
return PathData.Empty;
}
示例2: ResolveUrl
public virtual PathData ResolveUrl(Url url)
{
try
{
if (IsObservable(url))
return parser.ResolvePath(url.RemoveDefaultDocument(Url.DefaultDocument).RemoveExtension(observedExtensions));
}
catch (Exception ex)
{
errorHandler.Notify(ex);
}
return PathData.Empty;
}
示例3: ResolveUrl
public virtual PathData ResolveUrl(Url url)
{
// simple cache to help with multiple requests for same URL - PoC
if ((lastUrl != null) && (lastUrl.Item1 == url.ToString()))
{
var result = lastUrl.Item2;
lastUrl = null;
return result;
}
try
{
var path = parser.FindPath(url.RemoveDefaultDocument(Url.DefaultDocument).RemoveExtension(observedExtensions));
path.CurrentItem = path.CurrentPage;
if (draftRepository.Versions.TryParseVersion(url[PathData.VersionIndexQueryKey], url["versionKey"], path))
{
lastUrl = new Tuple<string, PathData>(url, path);
return path;
}
string viewPreferenceParameter = url.GetQuery(WebExtensions.ViewPreferenceQueryString);
if (viewPreferenceParameter == WebExtensions.DraftQueryValue && draftRepository.HasDraft(path.CurrentItem))
{
var draft = draftRepository.Versions.GetVersion(path.CurrentPage);
path.TryApplyVersion(draft, url["versionKey"]);
}
lastUrl = new Tuple<string, PathData>(url, path);
return path;
}
catch (Exception ex)
{
errorHandler.Notify(ex);
}
return PathData.Empty;
}