J
Joel Leong
I wonder how I can refer or get my web app root directory
without using code behind.
Here is my scenario.
I created the folders below
--WebAppRoot
----common
----img (assume a file called myimage.jpg is inside)
----reports
------finance
------admin
I hosted the app @ http://www.myhost.com/WebApps/
If I want to refer to http://www.myhost.com/ root dir, I
can use /WebApps/img/myimage.jpg. I also can use relative
path ../img/myimages.jpg if the HTML file is in reports
folder and ../../img/myimages if I'm in Finance folder.
My problem is I created a ASCX control which to be used
by all the pages. This ASCX control will render an IMG
tag that use this image. How should I specify the src for
this IMG tag? I cannot hard code my image to /WebApps
since WebApps dir may change later.
What is the industrial practice? Use code behind? How
would the code behind looks like if that is the case.
without using code behind.
Here is my scenario.
I created the folders below
--WebAppRoot
----common
----img (assume a file called myimage.jpg is inside)
----reports
------finance
------admin
I hosted the app @ http://www.myhost.com/WebApps/
If I want to refer to http://www.myhost.com/ root dir, I
can use /WebApps/img/myimage.jpg. I also can use relative
path ../img/myimages.jpg if the HTML file is in reports
folder and ../../img/myimages if I'm in Finance folder.
My problem is I created a ASCX control which to be used
by all the pages. This ASCX control will render an IMG
tag that use this image. How should I specify the src for
this IMG tag? I cannot hard code my image to /WebApps
since WebApps dir may change later.
What is the industrial practice? Use code behind? How
would the code behind looks like if that is the case.