Copied to clipboard

Flag this post as spam?

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


  • Siw Ørnhaug 130 posts 109 karma points
    Oct 03, 2011 @ 23:41
    Siw Ørnhaug
    0

    Redirect template fails after upgrade from v. 4.0.3 to v. 4.5.2

    Hi,
    I've tried to enter this topic twice and it just disappeared? It may be this topic belongs under installation I'm trying it here once more.

    Situation: I'm upgrading a site from 4.0.3 to 4.7.1. That is, I've come as far as the 4.5.2 step.
    The site has language versions organized via 3 topnodes. They are not associated with hostnames. All three has the same redirect template. Structure:
    Content
       NO
          Start...
       EN
          Start...
       DE
          Start...

    I first copied the site to staging site with a very temporary name, totally different from the real domain names. This was no problem with v. 4.0.3. It ran nicely under the tamporary url after copying it there.

    Upgrade to 4.5.2 went smoothly, except for 2 errors. One in an xslt and one in the redirect template on the top nodes. I can run umbraco without errors, but the frontend will not resolv.
    I'm sure the reason is the same for the 2 errors, best illustrated by the error message and by the redirect template itself: Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

    Exception Details: System.ArgumentOutOfRangeException: Index and length must refer to a location within the string.
    Parameter name: length

    Source Error:

    Server Error in '/' Application. 

    Index and length must refer to a location within the string.
    Parameter name: length
    
    
    
    Line 2:  <asp:Content ContentPlaceHolderID="ContentPlaceHolderDefault" runat="server">
    Line 3:  <%
    Line 4:    switch (Request.ServerVariables["URL"].Substring(1,3).ToLower())
    Line 5:    {
    Line 6:      case "de.":

     


    Source File: c:\inetpub\trollaktiv.no\masterpages\Redirect.master    Line: 4

    Stack Trace:

     

     

     

    And here's the template:

    <%@ Master Language="C#" MasterPageFile="/umbraco/masterpages/default.master" AutoEventWireup="true" %>
    <asp:Content ContentPlaceHolderID="ContentPlaceHolderDefault" runat="server">
    <%
      switch (Request.ServerVariables["URL"].Substring(1,3).ToLower())
      {
        case "de.":
        case "de/":
          Response.Redirect("/de/forside.aspx");
          break;
        case "en.":
        case "en/":
          Response.Redirect("/en/forside.aspx");
          break;
       
        case "no.":
        case "no/":
        default:
          Response.Redirect("/no/forside.aspx");
          break;
      }
    %>
    </asp:Content>

    What bugs me is why this was no problem in the staged v. 4.0.3?
    Can I just continue upgrading to v. 4.7.1 and when DNS pointers are updated I can expect everything to work fine?

    I feel utterly blond. Can anyone explain this to me?

    Siw

     

  • Siw Ørnhaug 130 posts 109 karma points
    Oct 04, 2011 @ 00:00
    Siw Ørnhaug
    0

    As anyone can see, the editor couldn't handle my code insertions very well, hope you still understand it :-)

  • Siw Ørnhaug 130 posts 109 karma points
    Oct 04, 2011 @ 12:51
    Siw Ørnhaug
    0

    What I found out was that the server variable URL no longer contains anything. At least not under the circumstances my staged site ran. I supose it's changed from asp.net 2.0 to asp.net 4.0?

    I've changed the redirect script to use the variable HTTP_HOST, but I could also have used SERVER_NAME. Does anyone know if I should use the one before the other?

Please Sign in or register to post replies

Write your reply to:

Draft