Copied to clipboard

Flag this post as spam?

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


  • Devin Bost 37 posts 78 karma points c-trib
    Jan 27, 2014 @ 09:55
    Devin Bost
    0

    Resources only load when trailing forward slash is omitted from URL (v 7.0.1)

    Hi,

    I have a rather bizarre problem involving display rendering. My content will only render properly when there is no forward slash (/) at the end of my URLs. I have determined that I am getting errors when the styles and dependency resources load. For some reason, when the forward slash is appended to the end of the URL, the resources try to load from a different URL than they should. For example, when I try to load http://localhost:18996/getting-started/, the images load from http://localhost:18996/getting-started/images/, which doesn't exist. When I load http://localhost:18996/getting-started, however, the images load from the correct location (/images). I am getting the same problem with styles. For example, when I try to load http://localhost:18996/getting-started/, one of my style sheets tries to load from http://localhost:18996/getting-started/css/style.css when it really should just be loading from /css/style.css. All of the other styles exhibit the same phenomena. Interestingly, the same problem does not occur with javascript files. They all seem to load from /scripts just fine.

    I am running:

    • MVC 4
    • ASP.NET v4.0.30319
    • Umbraco 7.0.1
    • Windows 7 (x64)
    • Visual Studio 2012 Ultimate
    • Umbraco was installed on this machine via NuGet Package

    I tried renaming the TEMP folder (App_Data\TEMP), but that didn't seem to affect this. Setting to (config\umbracoSettings.config) seems to provide a workaround, but the workaround doesn't prevent users and search engines from finding the broken links. The workaround also doesn't seem to solve problems involving children. For example, http://localhost:18996/go-further/test-me still fails to resolve css and images properly (due to the same bug). All of the images of http://localhost:18996/go-further/test-me return 404 pages.

    The last thing that changed is that I installed OAuth through Nuget, but I honestly don't know how long this URL issue has been a problem. It very well may have been an issue before I installed OAuth.

  • John A 20 posts 44 karma points
    Jun 15, 2014 @ 03:57
    John A
    2

    Hi,

    I had the exact problem with css and js included files, for example:

    <link rel="stylesheet" type="text/css" media="screen" href="css/font-awesome.min.css">
    

    would not render properly if a trailing forward slash (/) was included in the URL. The simple solution was to refer to the application root directory by adding ~/ to all css and js file includes, such as:

    <link rel="stylesheet" type="text/css" media="screen" href="~/css/font-awesome.min.css">
    

    Problem solved.

Please Sign in or register to post replies

Write your reply to:

Draft