Embedded Resource Issues on Staging
Hi,
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"
;
virtualPathConfig.VirtualPaths.Add(blahUIVirtualPathConfig);
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:
<
asp:Image
runat
=
"server"
ID
=
"image1"
ImageUrl
=
"~/SFRes/images/Sitefinity.Samples/Images.DefaultPhoto.png"
/>