Trouble using ResourceLinks

Posted by Community Admin on 04-Aug-2018 16:53

Trouble using ResourceLinks

All Replies

Posted by Community Admin on 07-Apr-2013 00:00

Hi, I am getting server errors when trying to use ResourceLinks and pointing it to a jQuery library.
 
<%@ Register Assembly="Telerik.Sitefinity" Namespace="Telerik.Sitefinity.Web.UI 
TagPrefix="sf" %>
    <sf:ResourceLinks ID="ResourceLinks1" runat="server">
        <sf:ResourceFile Name="~/Sitefinity/WebsiteTemplates/MyTemplate/js/jquery-1.9.1.min.js" />
    </sf:ResourceLinks>

The site is running on IIS6. No matter how change the formatting of the path to the .js file I get the attached server error. The file is there, I don't know why it's not seen. Any help would greatly be appreciated. I'm running SF 5.4.4.020.

Thanks,

Scott

Posted by Community Admin on 08-Apr-2013 00:00

Hey Scott,

Given you're running IIS, it could be a virtual-path resolver issue or a simple typo on the url to the JS file. But if I'm not mistaking the thing that's missing on the sf:ResourceFile line is Static="True".

The easier method for including jQuery would be this:

<sf:resourcelinks id="ResourceLinks1" runat="server">
  <sf:ResourceFile JavaScriptLibrary="JQuery" />
</sf:resourcelinks>

Where it resolves the library. Or use a control like this for any other JS file:
<sf:JavaScriptEmbedControl id="script1" runat="server" scriptembedposition="InPlace" url="/somefolder/somefile.js" />

FYI
Sitefinity's not compatible with jQuery 1.9.x. I haven't seen any direct bugs, but I've seen Kendo break so as a rule of thumb, it's better to not go beyond the included version...

Posted by Community Admin on 08-Apr-2013 00:00

Hi Jochem,

Thanks for responding and the tips on the internal Sitefinity jQuery. Referencing Sitefinity's internal jQuery worked, but I also have a couple other .js files in the same directory that I need to reference. I've tried your mention of making it Static="True" and the JavaScriptEmbeddedControl but neither worked. I think it does have something with IIS 6 virtual directory pathing because those statements work fine on the production server which is IIS 7.5.

Thanks again and let me know if you have any other ideas.

Scott

Posted by Community Admin on 10-Apr-2013 00:00

This is odd. On the production server I duplicated a masterpage template that was working with the ResourceLinks and merely renamed it, and I'm getting the same error that I'm getting locally in my development environment. I don't know how these two pages that have the ResourceLinks referenced are working, and the ones I create exact duplicates of them don't. 

Scott

Posted by Community Admin on 10-Apr-2013 00:00

Challenge accepted :)

Shoot me an email or drop me a link on Twitter/G+ with a copy of the .Master that's causing you headaches.

Regarding IIS 6 setup it can be troublesome, 
There's a tweak floating around the forum (which you've probably seen & tried)

<add verb="*" path="*.css,*.js,*.jpg,*.jpeg,*.gif,*.png" type="System.Web.StaticFileHandler" />

which seem to relieve some IIS6 pain, One issue I've ran into that caused me sleepless nights was a little checkbox marked 'Verify that file exists' which naturally shouldn't be checked because we're talking about virtual files. But without knowing anything more it's a shot in the dark.

---
If you're just looking for a pain killer, you can also simply use <script> tags to load the other js libraries.

Jochem

Posted by Community Admin on 10-Apr-2013 00:00

Hi Jochem,

Thanks for helping on this. I think I figured it out. I got it to work by enabling the UseEmbededThemes="false" property on the ResourceLinks control. So, this does work:

<%@ Register Assembly="Telerik.Sitefinity" Namespace="Telerik.Sitefinity.Web.UI 
TagPrefix="sf" %>
    <sf:ResourceLinks ID="ResourceLinks1" runat="server" UseEmbeddedThemes="false">
        <sf:ResourceFile Name="~/Sitefinity/WebsiteTemplates/MyTemplate/js/jquery-1.9.1.min.js" />
    </sf:ResourceLinks>

Thanks again for all your time,

Scott

Posted by Community Admin on 15-Apr-2013 00:00

Hi,

Thank you Jochem for helping Scott and thank you both of you for sharing the information and your solutions with the community.

Regards,
Stefani Tacheva
the Telerik team

Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items

This thread is closed