Why are my images not displaying on my archive web form?


Why are my images not displaying in my archive web form?


By default, an image file has a reference to a relative path to your web project folder when it is added in Visual Studio, but once an archive form is generated by WorkflowGen, this archive page is not located in the same web project folder. Therefore, the image link will be broken.


In the .aspx file, when an image is assigned on the form, the control has the ImageUrl attribute pointing to a relative path.


<asp:Image ID="imgLogo" runat="server" ImageAlign="AbsMiddle" ImageUrl="~/images/logo.jpg" />

To make sure the archive page can recognize the absolute path of the image file, you need to specify in your code-behind the image path relative to the WorkflowGen folder at the website level.

Example (C# code)

this.imgLogo.ImageUrl = /wfgen/WfApps/Webforms/Project/images/logo.jpg;

You can also store the path to the root folder for all the image files in your web.config file instead of repeating the path for every image used in your web form.


In the web.config, add a new key:

<add key="ImageFolder" value=/wfgen/WfApps/Webforms/Project/images//>

In code-behind:

this.imgLogo.ImageUrl = ConfigurationManager.AppSettings["ImageFolder"] + "logo.jpg";