User Control Images do not appear on sub directory web pages

Hi experts,

I am working on an .ASP net project. I have created some user controls which are in a folder named "Controls" . This folder also contains the images folder that store user control images.

I have no problem viewing the controls with their images on folders that are in the main directory, like the default.aspx page.
But when i insert these controls to another pages which are under some folders, and view it on browser i am ot able to see the images on user controls.

One way to solve this problem i found is to have an images folder on all sub folders in my project, but this is not managable of course.

I would appreciate if anyone can help me on how to fix this problem, and some best practices on how to deal with similar problems.

thanks
cakirfatihAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

HeadspaceCommented:
...how are you assigning the path to the image in the user controls?
cakirfatihAuthor Commented:
since the user control and image folder are in the same folder, when i look at the propoerties of the image it shows like this  " images/img17"

i am not sure if this responds your question.
HeadspaceCommented:
ok, try adding the full path to the image in the user control.  So, instead of using "images/img17", use "~/Controls/images/img17".

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Exploring ASP.NET Core: Fundamentals

Learn to build web apps and services, IoT apps, and mobile backends by covering the fundamentals of ASP.NET Core and  exploring the core foundations for app libraries.

cakirfatihAuthor Commented:
ok i will try this
but what is the  ~ sign you typed for the path means?
HeadspaceCommented:
'~' is used to denote the root directory of the site, so if the 'Controls' folder is not located at the root, then you'll need to place the appropriate path between '~' and 'Controls'.
cakirfatihAuthor Commented:
I have also used document relative links for the pictures

thanks for your response
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
ASP.NET

From novice to tech pro — start learning today.