Embedded Resource Issues on Staging

Posted by Community Admin on 04-Aug-2018 17:46

Embedded Resource Issues on Staging

All Replies

Posted by Community Admin on 11-May-2011 00:00


We've migrated all of our references to embedded resources in our custom controls to the new format using the VPP, we added the code to the global.asax file and got everything up and running in development.
Global.asax code

protected void Application_Start(object sender, EventArgs e)
            Telerik.Sitefinity.Abstractions.Bootstrapper.Initialized += new EventHandler<Telerik.Sitefinity.Data.ExecutedEventArgs>(Bootstrapper_Initialized);
        protected void Bootstrapper_Initialized(object sender, Telerik.Sitefinity.Data.ExecutedEventArgs args)
            if (args.CommandName == "RegisterRoutes")
                var virtualPathConfig = Config.Get<VirtualPathSettingsConfig>();
                var blahUIVirtualPathConfig = new VirtualPathElement(virtualPathConfig.VirtualPaths)
                    VirtualPath = "~/blah/*",
                    ResolverName = "EmbeddedResourceResolver",
                    ResourceLocation = "Blah.Sitefinity.UI"

Our embedded images work in our controls and are returned if I call them directly using something like the following:


The problem is when we move this code to our staging server our embedded images no longer show up and I can't hit them directly.

Some things I already checked for include the following:
-The images are marked as embedded resources
-I checked the assemblyinfo.cs file to be sure that the resource is there

Any suggestions?


Posted by Community Admin on 13-May-2011 00:00

Hi SteveW,

We have sent a response in the support ticket you have opened. For convenience, here is our response:

Yes it is possible to reference images from embedded locations. However you have to always call the ~/SfRes virtual path (not yours) in order to get the provider to serve the images. You have to follow the bellow convention

1) Set the images as embedded resources / it is not necessary to set them as embedded resources.
2) When constructing the virtual path you should follow the following convention ~/SfRes/images/AssemblyName/Path. For example if your assembly is called Sitefinity.Samples and inside you have a folder called Images here is how the path should look like:

Copy Code
<asp:Image runat="server" ID="image1" ImageUrl="~/SFRes/images/Sitefinity.Samples/Images.DefaultPhoto.png" />

3) You can use the RouteHelper.ResolveUrl static method in order to resolve urls to application relative paths, rooted paths, absolute paths, etc.

Best wishes,
Radoslav Georgiev
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