all groups > asp.net > april 2004 >
You're in the

asp.net

group:

adress of project folder


Re: adress of project folder Ken Cox [Microsoft MVP]
4/3/2004 8:36:56 PM
asp.net:
Don't forget that the tilde (~) is resolved as the root of the Web. That
means you can get at the images folder from anywhere using syntax like this:

Image1.ImageUrl = "~/images/thumbs/001.jpg"

Ken
Microsoft MVP [ASP.NET]


[quoted text, click to view]
adress of project folder Jarod_24
4/3/2004 10:50:36 PM
I got a function that return the url of a image, the problem is that the image control on the .aspx page automaticaly adds the
adress of itself to the adress

Example:
The page http://localhost/myapp/pages/misc/index.aspx calls the function, and it returns the string "images\thumb\001.jpg"

The image control on the page will then point to the adress: http://localhost/myapp/pages/misc/images\thumb\001.jpg (wich is wrong).

The image folder is located at root of my project (myapp) so the adress should be: http://localhost/myapp/images\thumbs\001.jpg

Since the pages could be in different sub-folders at different levels under the myapp folder i can't simply add "..\..\..\" to fix
it.

Is there any function that will return the http://localhost/myapp (the rootof my project folder)?
I tried using System.AppDomain.CurrentDomain.BaseDirectory() but that will return the path as "c:\inetwww\myapp\"

Re: adress of project folder Bruno Sirianni
4/4/2004 1:32:59 AM
You can use Request.Url, or set an app value in Web.Config.
Brun


[quoted text, click to view]

Re: adress of project folder Jarod_24
4/5/2004 1:18:18 AM
[quoted text, click to view]

Thanks. That worked like a charm.
Just added a "~/" at the start of the string.

[quoted text, click to view]

AddThis Social Bookmark Button