Ejemplo n.º 1
0
 private static bool RedirectToCustomUrl(System.Web.HttpApplication app, Content.CustomUrl u, UrlRewriterParts parts)
 {
     if (u.RedirectToUrl.ToLower().StartsWith("http"))
     {
         if (parts.HasQuery)
         {
             app.Response.Redirect(JoinUrlAndQuery(u.RedirectToUrl, parts.Query));
             return(true);
         }
         else
         {
             app.Response.Redirect(u.RedirectToUrl);
             return(true);
         }
     }
     else
     {
         string outputPath = u.RedirectToUrl;
         outputPath = MakeRelativeCustomUrlSafeForApp(outputPath, app.Request.ApplicationPath);
         if (parts.HasQuery)
         {
             app.Context.RewritePath(JoinUrlAndQuery(outputPath, parts.Query), false);
             return(true);
         }
         else
         {
             app.Context.RewritePath(outputPath, false);
             return(true);
         }
     }
 }
Ejemplo n.º 2
0
        public static bool IsUrlInUse(string requestedUrl, string thisCustomUrlBvin, RequestContext context, MerchantTribeApplication app)
        {
            bool   result  = false;
            string working = requestedUrl.ToLowerInvariant();

            // Check for Generic Page Use in a Flex Page
            if (IsCategorySlugInUse(working, thisCustomUrlBvin, context))
            {
                return(true);
            }

            // Check for Products
            if (IsProductSlugInUse(working, thisCustomUrlBvin, app))
            {
                return(true);
            }

            // Check Custom Urls
            Content.CustomUrl url = app.ContentServices.CustomUrls.FindByRequestedUrl(requestedUrl);
            if (url != null)
            {
                if (url.Bvin != string.Empty)
                {
                    if (url.Bvin != thisCustomUrlBvin)
                    {
                        return(true);
                    }
                }
            }
            return(result);
        }