Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Peter Cort Larsen 421 posts 1038 karma points
    Dec 17, 2014 @ 21:28
    Peter Cort Larsen
    0

    httpmodule disable for backend

    I am writing a httpmodule for umb 7.2

    But i only want it to take action on the frontende of the website, not when in the backend.

    Any ideas?

     private void Application_BeginRequest(Object source, EventArgs e)
    {
    HttpApplication application = (HttpApplication)source;
    HttpContext context = application.Context;


    string UrlReferrer = context.Request.UrlReferrer.GetLeftPart(UriPartial.Authority).Replace("https://", "").Replace("http://", "");
    bool doRedirect = false;


    if (System.Configuration.ConfigurationManager.AppSettings["domain.redirectToCaseFromUrls"] != null)
    {
    if (System.Configuration.ConfigurationManager.AppSettings["domain.redirectToCaseFromUrls"].ToString() != "")
    {
    string[] refs = System.Configuration.ConfigurationManager.AppSettings["domain.redirectToCaseFromUrls"].ToString().Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);

    foreach (string item in refs)
    {
    if (item.IndexOf(UrlReferrer) >= 0)
    {
    doRedirect = true;
    }
    }
    }
    }
    }
  • Nicholas Westby 2054 posts 7103 karma points c-trib
    Dec 17, 2014 @ 22:24
    Nicholas Westby
    100

    Could you simply check if the request URL starts with "/umbraco"?

  • Peter Cort Larsen 421 posts 1038 karma points
    Dec 18, 2014 @ 15:28
    Peter Cort Larsen
    0

    dohh, why didnt i think of this?

Please Sign in or register to post replies

Write your reply to:

Draft