Copied to clipboard

Flag this post as spam?

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


This forum does not allow new topics to be created, please use the v2 forum from now on.

  • Rune Grønkjær 1303 posts 2895 karma points
    Oct 12, 2012 @ 12:30
    Rune Grønkjær
    0

    404 handler not catching 404 page

    Hi,

    First of all. I have set up the web.config to let Umbraco catch and handle 404 requests. My 404Handlers.config looks like this:

    <?xml version="1.0" encoding="utf-8"?>
    <NotFoundHandlers>
      <notFound assembly="umbraco" type="SearchForAlias" />
      <notFound assembly="umbraco" type="SearchForTemplate" />
      <notFound assembly="umbraco" type="SearchForProfile" />
      <notFound assembly="InfoCaster.Umbraco._301UrlTracker" type="Handler301URLTracker" />
      <notFound assembly="uComponents.NotFoundHandlers" type="MultiSitePageNotFoundHandler" />
      <notFound assembly="umbraco" type="handle404" />
    </NotFoundHandlers>

    And the uComponents.NotFoundHandlers works like a charm, giving me the selected umbraco page. The 301 url tracker on the other hand does nothing. Everything in the backend looks just like your screenshots, but when I change the name of a page I just get my regular 404 page, and not my renamed page. In my settings section I can see that the page has been added with the correct url and stuff.

    Do I have to set something else up in the web.config for 301 url tracker to kick in?

    Any help is appreciated.

    /Rune

  • Stefan Kip 1606 posts 4098 karma points c-trib
    Oct 12, 2012 @ 12:32
    Stefan Kip
    0

    Which version of the 301 URL Tracker are you using?

  • Rune Grønkjær 1303 posts 2895 karma points
    Oct 12, 2012 @ 12:46
    Rune Grønkjær
    0

    Yes sorry. 301 Url tracker v1.5 and Umbraco v4.9.0.

    /Rune

  • Stefan Kip 1606 posts 4098 karma points c-trib
    Oct 12, 2012 @ 12:48
    Stefan Kip
    0

    Well the problem for me is; I've tested it on a clean umbraco v4.9.0 installation and I can't look into yours, so it's impossible for me to tell you what's wrong at this point.

  • Rune Grønkjær 1303 posts 2895 karma points
    Oct 12, 2012 @ 12:50
    Rune Grønkjær
    0

    Yep, I'm aware of that. I was hoping that you knew some other bonehead like me who couldn't make it work :)

    Should there be anything in the web.config specific for your package?

    /Rune

  • Stefan Kip 1606 posts 4098 karma points c-trib
    Oct 12, 2012 @ 12:53
    Stefan Kip
    0

    Nope, as long as the assembly is in place and the 404handler is configured, it should work.

    • What is the old url of your page? 
    • Does this old url have an entry in SQL in the 301infocaster table?
    • If so, are there any differences between the url you're requesting and the url in the table? Like traling slash?
  • Rune Grønkjær 1303 posts 2895 karma points
    Oct 12, 2012 @ 12:56
    Rune Grønkjær
    0

    The old url: http://bestpractice.teasolutions.dk/page1/

    Yes, it gets created in your database table and it looks like this:

    NodeID    OldUrl    IsCustom    IsRegex    Message    Inserted
    1064    /page1/    0    0    This document was renamed    2012-10-12 12:23:58.953

    /Rune

     

  • Stefan Kip 1606 posts 4098 karma points c-trib
    Oct 12, 2012 @ 13:52
    Stefan Kip
    0

    Could you check if the 301 URL Tracker is called by viewing the Trace information?

  • Rune Grønkjær 1303 posts 2895 karma points
    Oct 12, 2012 @ 14:46
    Rune Grønkjær
    0

    It looks like it does:

    notFoundHandler    Trying NotFoundHandler 'umbraco.SearchForAlias'...    0.011691    0.000036
    urlAlias    'page1'    0.011836    0.000144
    notFoundHandler    Trying NotFoundHandler 'umbraco.SearchForTemplate'...    0.012075    0.000240
    notFoundHandler    Trying NotFoundHandler 'umbraco.SearchForProfile'...    0.012182    0.000107
    notFoundHandler    Trying NotFoundHandler 'InfoCaster.Umbraco._301UrlTracker.Handler301URLTracker'...    0.012272    0.000090
    notFoundHandler    Trying NotFoundHandler 'uComponents.NotFoundHandlers.MultiSitePageNotFoundHandler'...    0.023574    0.011302
    notFoundHandler    NotFoundHandler 'uComponents.NotFoundHandlers.MultiSitePageNotFoundHandler found node matching page1 with id: 1108    0.023958    0.000384

    So far so good. So now it looks like it cannot find the database entry.

    /Rune

  • Stefan Kip 1606 posts 4098 karma points c-trib
    Oct 12, 2012 @ 14:49
    Stefan Kip
    1

    This is really weird, I'm afraid there's only 1 option; to find the problem it has to get debugged.
    The source is available on the front page, so you could have a go for yourself if you'd like.

    Otherwise, the only 'solution' would be to give me a zip file containing the umbraco instance; filesystem and SQL db.

  • Rune Grønkjær 1303 posts 2895 karma points
    Oct 12, 2012 @ 14:55
    Rune Grønkjær
    0

    I will have a go at the source code myself. I should be able to find the problem.

    Going on vacation today though, so it might be some time before I have a result. I will post it back here when I have it.

    /Rune

  • Rune Grønkjær 1303 posts 2895 karma points
    Oct 12, 2012 @ 14:55
    Rune Grønkjær
    0

    Oh, and thanks for the help so far! I really appreciate it.

    /Rune

  • Stefan Kip 1606 posts 4098 karma points c-trib
    Oct 12, 2012 @ 14:59
    Stefan Kip
    0

    Aight, no problem.

    Good luck and please do reply when you've found something.

  • Rune Grønkjær 1303 posts 2895 karma points
    Nov 15, 2012 @ 09:22
    Rune Grønkjær
    0

    Hi Kip,

    Finally I got the time to debug this, and I found the problem.I think it's a problem anyways. It seems that your Handler301URLTracker.cs checks the domain rootnode against the "real" root node of the node tree. Lines 100 and 101:

    Node rootNode = n.FindRoot();
    if (rootNode.Id == root || root == -1)

    My site does not pass this small test, and therefore can not be redirected to the correct page, which is found and everything.

    I'm not sure what to do about this, and why that check is there in the first place. You cannot expect the domain to be set at root level. My tree looks like this:

    What to do? I could delete the step and use my own forked version, but if you can fix it in general others could benefit as well. :)

    /Rune

  • Stefan Kip 1606 posts 4098 karma points c-trib
    Nov 15, 2012 @ 09:39
    Stefan Kip
    0

    Yes I can see why it goes wrong in that situation.
    We've always worked with rootnodes, that's why I've never thought about it going wrong ;-)

    The reason I check the 'rootnode', is because of multiple websites in one umbraco installation. I know this check is for when url's are relatively saved.
    But with the new Umbraco versions I'm not sure if that's still the case when 'useDomainPrefixes' is set to true.

    I'll have to check this out to think about a fix, but I'm not sure when I'll have time to do so.
    Ofcourse you can fix it for now in your current situation, but I will look into fixing this.

  • Rune Grønkjær 1303 posts 2895 karma points
    Nov 15, 2012 @ 09:42
    Rune Grønkjær
    0

    Cool. I'll make a fix for myself and then I can update when you get to look into it. My solution will probably be to remove that check all together. Can't se what I can use it for. :)

    Thanks for the quick response.

    /Rune

  • Arjan H. 142 posts 275 karma points
    Nov 27, 2012 @ 15:38
    Arjan H.
    0

    I'm dealing with the same issue. Did any of you implement a fix for this?

  • Rune Grønkjær 1303 posts 2895 karma points
    Nov 27, 2012 @ 15:44
    Rune Grønkjær
    0

    Hi Arjan,

    Yes I have fixed it in my version of the source code. Here's my version of the dll:
    http://dl.dropbox.com/u/20891897/Infocaster%20301UrlTracker/InfoCaster.Umbraco._301UrlTracker.dll

    /Rune

  • Arjan H. 142 posts 275 karma points
    Nov 27, 2012 @ 16:02
    Arjan H.
    0

    Thanks! It seems to be working, kinda...

    Somehow the 301 URL Tracker works as some sort of regular 404 page handler: it returns a 404 status for the mapped URL, and then loads the page it was mapped to, but without redirecting the browser.

    So I have a page in Umbraco /nl/oplossingen, and in the 301 URL Tracker property I added a custom mapping: /paginas/16-oplossingen

    http://www.domain.com/paginas/16-oplossingen should redirect (with status 301) to http://www.domain.com/nl/oplossingen but instead it doesn't redirect, it just shows the page "transparently" without changing the URL in the browser. So it basically operates as a umbracoUrlAlias instead of 301 redirect.

    Any ideas?

  • Stefan Kip 1606 posts 4098 karma points c-trib
    Nov 27, 2012 @ 16:13
    Stefan Kip
    0

    @Arjan

    Seems like the 301 URL Tracker didn't do it's job, in other words; it didn't match the requested url.
    I can't give you a reason, that would require debugging with your situation...

  • Arjan H. 142 posts 275 karma points
    Nov 30, 2012 @ 15:47
    Arjan H.
    0

    @kipusoep

    When I change the following code (line 115-118 of Handler301URLTracker.cs):

    _redirectID = redirectId;
    HttpContext.Current.Response.Status = "301 Moved Permanently";
    HttpContext.Current.Response.AddHeader("Location", n.NiceUrl);
    return true;

    to:

    _redirectID = redirectId;
    HttpContext.Current.Response.Status = "301 Moved Permanently";
    HttpContext.Current.Response.AddHeader("Location", n.NiceUrl);
    HttpContext.Current.Response.End();
    return true;

    then the 301 status is correctly returned.

    Of course everything after Response.End() isn't processed. If I leave out the Response.End() the code somehow returns a 404 status instead. I'll have to do some further debugging to find out what code overrides the 301 status setting, but maybe you have an idea what to look for? Btw, I have disabled all other NotFoundHandlers, so the 301 URL Tracker is the only handler that's being triggered.

  • Stefan Kip 1606 posts 4098 karma points c-trib
    Nov 30, 2012 @ 15:55
    Stefan Kip
    0

    I found the same bug yesterday and I fixed in the source with Response.End(), but haven't released it yet ;-)

  • Arjan H. 142 posts 275 karma points
    Nov 30, 2012 @ 15:59
    Arjan H.
    0

    Did you add the Response.End() at the same location I did? Or did you make additional changes? I'd like to compile a fix right now, and deploy to one of our clients' sites.

  • Stefan Kip 1606 posts 4098 karma points c-trib
    Nov 30, 2012 @ 16:02
    Stefan Kip
    0

    Yes exactly the same location, no additional changes.

  • Arjan H. 142 posts 275 karma points
    Nov 30, 2012 @ 16:04
    Arjan H.
    0

    Perfect, I'll compile and deploy right away.

    Btw, while you're at it, you might want to add a Response.Clear() too:

     

    _redirectID = redirectId;
    HttpContext.Current.Response.Clear();
    HttpContext.Current.Response.Status = "301 Moved Permanently";
    HttpContext.Current.Response.AddHeader("Location", n.NiceUrl);
    HttpContext.Current.Response.End();
    return true;

     

  • Arjan H. 142 posts 275 karma points
    Nov 30, 2012 @ 16:11
    Arjan H.
    0

    It's working:

    *thumbs up*

  • Esben Sundgaard 2 posts 22 karma points
    Dec 06, 2012 @ 11:07
    Esben Sundgaard
    0

    @kipusoep

    Will you release a new version with the fix soon? I have the same problem with the version 1.5.1 :-/

  • Arjan H. 142 posts 275 karma points
    Dec 06, 2012 @ 11:20
    Arjan H.
    0

    @Esben: Until there's an official release, here's the altered 1.5.1 version I'm currently using:

    https://dl.dropbox.com/u/103449/InfoCaster.Umbraco._301UrlTracker.dll

  • Esben Sundgaard 2 posts 22 karma points
    Dec 06, 2012 @ 11:22
    Esben Sundgaard
    0

    @Arjan H.

    Thank you :-)

  • Stefan Kip 1606 posts 4098 karma points c-trib
    Dec 06, 2012 @ 13:48
    Stefan Kip
    0

    @Esben

    I'll make sure a new version will be here soon.
    Meanwhile; Arjan thanks for the assistance! 

  • Dan Evans 616 posts 988 karma points
    Jan 14, 2013 @ 13:42
    Dan Evans
    1

    That's sorted it for me too. Shouldn't this be updated on the package download page ASAP as it seems pretty critical to me. 

  • Mads Rode 2 posts 22 karma points
    Jan 25, 2013 @ 11:18
    Mads Rode
    0

    First of all thank you very much for a great plugin, works sweet.

    I had the same experience with receiving 404 instead of 301 and it helped with the latest dll you have in your dropbox. I think the regex redirects are still returning 404?

    All the best, Mads

  • Arjan H. 142 posts 275 karma points
    Jan 25, 2013 @ 11:56
    Arjan H.
    0

    I just noticed my altered .dll also triggers another issue in v4.11.3. The thumbnails/previews in the Media section aren't loading anymore. I just see that animated loading GIF, and nothing happens. Using the original InfoCaster.Umbraco._301UrlTracker.dll fixes this issue, but then we're back to square one regarding the 404-instead-of-301-redirect issue. :-(

  • Doug Mackay 56 posts 155 karma points
    Feb 04, 2013 @ 15:03
    Doug Mackay
    0

    @Arjan H

    Not sure if this is the problem but your DLL is compiled against .Net 4.5 instead of 4.0 (you'll get a lot of YSOD if you try it on a server without 4.5 installed). 

    Also as already reported the same ending the response fix will need added to the MatchRegex method (until U4-1441 is resolved).

  • Peter Gregory 407 posts 1611 karma points MVP 3x admin c-trib
    Feb 12, 2013 @ 03:49
    Peter Gregory
    0

    Are there any plans to release an official fix for this?

  • Stefan Kip 1606 posts 4098 karma points c-trib
    Feb 12, 2013 @ 09:00
    Stefan Kip
    0

    Sure, I'll create a new release right away.

  • Stefan Kip 1606 posts 4098 karma points c-trib
    Feb 12, 2013 @ 09:11
    Stefan Kip
    0

    I've uploaded v1.5.2 which should fix this issue.

  • Arjan H. 142 posts 275 karma points
    Feb 12, 2013 @ 10:18
    Arjan H.
    0

    Does this new release also fix the MatchRegex issue?

  • Stefan Kip 1606 posts 4098 karma points c-trib
    Feb 12, 2013 @ 10:20
    Stefan Kip
    0

    Maybe you could provide more information about what you mean with 'the MatchRegex issue'?

  • Arjan H. 142 posts 275 karma points
    Feb 12, 2013 @ 10:25
    Arjan H.
    0

    See the comments made by Mads Rode and Doug Mackay in this thread.

  • Stefan Kip 1606 posts 4098 karma points c-trib
    Feb 12, 2013 @ 10:42
    Stefan Kip
    0

    Well as you can see in the source, the MatchRegex method also contains HttpContext.Current.Response.Clear() and HttpContext.Current.Response.End().
    So yes, that should be fixed too. 

  • Arjan H. 142 posts 275 karma points
    Feb 12, 2013 @ 10:45
    Arjan H.
    0

    Ah, hadn't had a chance to check the source yet. :-) Awesome!

  • Mads Rode 2 posts 22 karma points
    Feb 12, 2013 @ 11:23
    Mads Rode
    0

    Looks to work great, thanks for the updated version.

  • Peter Gregory 407 posts 1611 karma points MVP 3x admin c-trib
    Feb 12, 2013 @ 11:57
    Peter Gregory
    0

    Thanks for the quick turn around :)

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies