示例#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;
				}
			}			
		}			
示例#2
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);
         }
     }
 }