Resolve image paths for directory in visual studio?
In the root of my website, I have an images folder that I created in visual studio. In my backoffice, I have the a root node (Home) and underneath home, I have a Support node.
If I load templates (views) into the home node, the images come up fine if I use @Url.Content('...'), but underneath Support, I have another node called request and if I put images on this template, no images show. When I inspect the images source, instead of it pointing to /images/xyz.png, it is pointing to /support/images/xyz.png when I go to the request page.
How can I resolve these images?
Should I store the images in the media section? Would this make it easier to resolve or is my custom folder just fine?
Sorry, I should have given a better example. I am using the ~ character like in your example, but when I created the Support node in Umbraco, going up one level from Request (node that lives under Support) goes up to Support which does not exist in VS and looks for the images there?
I've tested this in both the Master template and in specific templates (rendered as children). It resolves correctly under two levels. Have you got a hardcoded string inside the Url.Content() like mine or are you using a picker? Can you paste the code?
There used to be a setting in IIS where you can turn off Parent Paths but I thought this was only classic ASP - have you got this on (though not sure how you'd do this in VS!?
I feel like I have wasted your time, sorry about that. I realized the problem. I was doing everything right, but for some reason when I made the change in visual studio to my template, it would not reflect in the back office when I refreshed the website, so in a nutshell, everything is working as expected.
Resolve image paths for directory in visual studio?
In the
root
of my website, I have animages folder
that I created invisual studio
. In mybackoffice
, I have the aroot node (Home)
and underneath home, I have aSupport node
.If I load templates (views) into the
home node
, the images come up fine if I use@Url.Content('...')
, but underneathSupport
, I have another node calledrequest
and if I put images on this template, no images show. When I inspect the images source, instead of it pointing to/images/xyz.png
, it is pointing to/support/images/xyz.png
when I go to therequest
page.How can I resolve these images?
Should I store the images in the media section? Would this make it easier to resolve or is my custom folder just fine?
Thanks, Saied
Hi,
Not sure I'd ever use virtual directories with Umbraco anyhow but include a tilda to ensure it resolves up.
There's some info here on using this - I tend to just hardcode my references :) http://stackoverflow.com/questions/10468987/why-should-i-use-url-content-blah-blah-blah
Hi Steve,
Sorry, I should have given a better example. I am using the
~
character like in your example, but when I created theSupport
node inUmbraco
, going up one level fromRequest (node that lives under Support)
goes up toSupport
which does not exist inVS
and looks for the images there?That is what I am struggling with?
Thanks
So your site structure is something like:
Home
In your template you have something like:
I've tested this in both the Master template and in specific templates (rendered as children). It resolves correctly under two levels. Have you got a hardcoded string inside the Url.Content() like mine or are you using a picker? Can you paste the code?
There used to be a setting in IIS where you can turn off Parent Paths but I thought this was only classic ASP - have you got this on (though not sure how you'd do this in VS!?
Hi Steve,
I feel like I have wasted your time, sorry about that. I realized the problem. I was doing everything right, but for some reason when I made the change in visual studio to my template, it would not reflect in the back office when I refreshed the website, so in a nutshell, everything is working as expected.
Thanks again, Saied
Though, again - you don't need Url.Content! http://stackoverflow.com/questions/17531484/url-content-not-working-on-complex-urls
is working on a reply...