本文整理汇总了C#中DotNetNuke.Entities.Urls.UrlAction.SetOriginalPath方法的典型用法代码示例。如果您正苦于以下问题:C# UrlAction.SetOriginalPath方法的具体用法?C# UrlAction.SetOriginalPath怎么用?C# UrlAction.SetOriginalPath使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DotNetNuke.Entities.Urls.UrlAction
的用法示例。
在下文中一共展示了UrlAction.SetOriginalPath方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ProcessRequest
private void ProcessRequest(HttpContext context,
Uri requestUri,
bool useFriendlyUrls,
UrlAction result,
FriendlyUrlSettings settings,
bool allowSettingsChange,
Guid parentTraceId)
{
bool finished = false;
bool showDebug = false;
bool postRequest = false;
HttpRequest request = context.Request;
HttpResponse response = context.Response;
string requestType = request.RequestType;
NameValueCollection queryStringCol = request.QueryString;
try
{
string fullUrl, querystring;
//699: get the full url based on the request and the quersytring, rather than the requestUri.ToString()
//there is a difference in encoding, which can corrupt results when an encoded value is in the querystring
RewriteController.GetUrlWithQuerystring(request, requestUri, out fullUrl, out querystring);
showDebug = CheckForDebug(request, queryStringCol, settings.AllowDebugCode);
string ignoreRegex = settings.IgnoreRegex;
bool ignoreRequest = IgnoreRequest(result, fullUrl, ignoreRegex, request);
bool redirectAlias = false;
if (!ignoreRequest)
{
//set original path
context.Items["UrlRewrite:OriginalUrl"] = requestUri.AbsoluteUri;
//set the path of the result object, and determine if a redirect is allowed on this request
result.SetOriginalPath(requestUri.ToString(), settings);
//737 : set the mobile browser
result.SetBrowserType(request, response, settings);
//add to context
context.Items["UrlRewrite:BrowserType"] = result.BrowserType.ToString();
//839 : split out this check
result.SetRedirectAllowed(result.OriginalPath, settings);
//find the portal alias first
string wrongAlias;
bool isPrimaryAlias;
var requestedAlias = GetPortalAlias(settings, fullUrl, out redirectAlias, out isPrimaryAlias, out wrongAlias);
if (requestedAlias != null)
{
//827 : now get the correct settings for this portal (if not a test request)
//839 : separate out redirect check as well and move above first redirect test (ConfigurePortalAliasRedirect)
if (allowSettingsChange)
{
settings = new FriendlyUrlSettings(requestedAlias.PortalID);
result.SetRedirectAllowed(result.OriginalPath, settings);
}
result.PortalAlias = requestedAlias;
result.PrimaryAlias = requestedAlias;//this is the primary alias
result.PortalId = requestedAlias.PortalID;
result.CultureCode = requestedAlias.CultureCode;
//get the portal alias mapping for this portal
result.PortalAliasMapping = PortalSettings.GetPortalAliasMappingMode(requestedAlias.PortalID);
//if requested alias wasn't the primary, we have a replacement, redirects are allowed and the portal alias mapping mode is redirect
//then do a redirect based on the wrong portal
if ((redirectAlias && wrongAlias != null) && result.RedirectAllowed && result.PortalAliasMapping != PortalSettings.PortalAliasMapping.Redirect)
{
//this is the alias, we are going to enforce it as the primary alias
result.PortalAlias = requestedAlias;
result.PrimaryAlias = requestedAlias;
//going to redirect this alias because it is incorrect
//or do we just want to mark as 'check for 301??'
redirectAlias = ConfigurePortalAliasRedirect(ref result,
wrongAlias,
requestedAlias.HTTPAlias,
false,
settings.InternalAliasList,
settings);
}
else
{
//do not redirect the wrong alias, but set the primary alias value
if (wrongAlias != null)
{
//get the portal alias info for the requested alias (which is the wrong one)
//and set that as the alias, but also set the found alias as the primary
PortalAliasInfo wrongAliasInfo = PortalAliasController.Instance.GetPortalAlias(wrongAlias);
if (wrongAliasInfo != null)
{
result.PortalAlias = wrongAliasInfo;
result.PrimaryAlias = requestedAlias;
}
}
}
}
}
ignoreRegex = settings.IgnoreRegex;
//.........这里部分代码省略.........