/*
private static void ProcessParametersRedirects(HttpApplication app, HttpResponse response, int portalId, string CultureCode, String myAlias, string cultureUrl, string tabUrl, string parameters, RedirectAction redirect)
{
if ((parameters.Trim().Length > 0))
{
UrlRule CtlRule = GetRedirectModuleRule(portalId, CultureCode, parameters.TrimStart('/').ToLower());
if (CtlRule != null)
{
if (CtlRule.RemoveTab)
{
redirect.RedirectUrl = redirect.RedirectUrl.Replace("/" + tabUrl, "");
}
redirect.RedirectUrl = redirect.RedirectUrl.Replace(parameters.TrimStart('/'), CtlRule.RedirectDestination);
redirect.DoRedirect = true;
redirect.Raison += "+ModuleRule:" + CtlRule.Url + ">" + CtlRule.RedirectDestination;
}
}
}
*/
private static void GetTab(CacheController cacheCtrl, RewriterAction action)
{
if (string.IsNullOrEmpty(action.WorkUrl))
return;
int tabID = Null.NullInteger;
string TabPath = action.WorkUrl;
string Parameters = "";
UrlRule TabRule;
do
{
TabRule = cacheCtrl.GetTabRule(action.CultureCode, TabPath);
if (TabRule != null)
{
action.TabId = TabRule.TabId;
action.WorkUrl = "";
action.PageUrl = TabPath;
action.ModuleUrl = Parameters.TrimStart('/');
if (TabRule.RemoveTab && string.IsNullOrEmpty(action.ModuleUrl) && string.IsNullOrEmpty(action.QueryUrl))
{ // redirect to alias
action.RedirectHomePage = true;
action.Status = TabRule.RedirectStatus;
action.DoRedirect = true;
action.Raison += "+Tab:" + TabRule.Url + "> alias";
}
else if (TabRule.Action == UrlRuleAction.Redirect)
{
//action.RedirectUrl = action.RedirectUrl.Replace("/" + TabRule.Url, "/" + TabRule.RedirectDestination);
action.RedirectPage = TabRule.RedirectDestination;
action.Status = TabRule.RedirectStatus;
action.DoRedirect = true;
action.Raison += "+Tab:" + TabRule.Url + ">" + TabRule.RedirectDestination;
}
else if (TabPath != TabRule.Url) // because different case
{
action.RedirectPage = TabRule.Url;
action.DoRedirect = true;
action.Raison += "+Wrong case";
}
break;
}
int slashIndex = TabPath.LastIndexOf('/');
if (slashIndex > 0)
{
Parameters = TabPath.Substring(slashIndex) + Parameters;
TabPath = TabPath.Substring(0, slashIndex);
}
else
{
TabPath = "";
}
} while (TabPath.Length > 0);
}