Products

Solutions

Resources

Partners

Community

Blog

About

QA

Ideas Test

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeOur CommunityOur CommunityGeneral Discuss...General Discuss...Virtual directory and src=/images/image1.jpg problemVirtual directory and src=/images/image1.jpg problem
Previous
 
Next
New Post
2/6/2009 1:00 AM
 

Hi,

We are using WAP setup. In project X we would like to use the images located at /portal/0/images/image1.jpg. We made client side code like 'src='/portal/0/images/image1/jpg' in an ascx control. However, it seems that with the virtualdirectory localhost/virtualdir we get no images since the src is rendered like /localhost/portal/0/images/image1/jpg instead of /localhost/virtualdir/portal/0/images/image1/jpg. The same problem happens if we want to use the images dir of dnn.

Using an host header fixes this problem. However, we do not fully understand why this is happening. It is much easier to use a virtual directory to set up a development environment instead you need to set up a hostheader. I do not see an advantage to use a hostheader, but now for some reason my virtualdir is not being used.

Any help appreciated.

J.

 
New Post
2/6/2009 1:08 AM
 

I'd have to double check, but I think you've got at least 2 choices...

  • mark the image placeholder as a serverside control (runat=server), and then prefix ~/ to the url.... "~/portals/0/images/image1.jpg"
  • ResolveUrl("~/portals/0/images/image1.jpg"), either via <img src='<%=ResolveUrl("~/portals/0/images/image1.jpg")%>'/>, or at runtime in your codebehind / page_load functions...

Let me know if I failed with my quick response :)

 
New Post
2/6/2009 1:56 AM
 

Thank you.

I would rather not use serverside controls since images are meant to be client side. So less page rendering and less server work to do on postback. Will ResolveUrl then also work?

J.

 
New Post
2/6/2009 2:12 AM
 

I'd try both ResolveUrl and MapPath, the more I think about it I'm pretty sure you'll want MapPath to get a valid path with the ~/ prefix. I think the ResolveUrl function will return the path based on the location of the control calling it (i.e.. if included in your module view control, it will return the desktopmodules path to your module plus the bits passed into it)

Just test this out at page_load, call both of these functions and write the output into a Label or Literal control to see what they return, or inside <%= %> blocks. It'll take 2 seconds :)

 
New Post
2/6/2009 2:13 AM
Accepted Answer 

Thankx it works also clientside.

 
Previous
 
Next
HomeHomeOur CommunityOur CommunityGeneral Discuss...General Discuss...Virtual directory and src=/images/image1.jpg problemVirtual directory and src=/images/image1.jpg problem


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out