Trouble using ResourceLinks
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
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
>
<
sf:JavaScriptEmbedControl
id
=
"script1"
runat
=
"server"
scriptembedposition
=
"InPlace"
url
=
"/somefolder/somefile.js"
/>
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
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
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"
/>
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
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