humm...Not sure I understood the initial question.
To me a "link" is an hyperlink. It looked like to me you were trying to
build (hyper)links in a web page referring to the server you are running on.
Now It looks like to me you want to find the physical location in the file
system that match a particular url location. Also I don't see how it has
something to do with the domain name...
Usually this is done with Server.MapPath that will take also in to account
virtual directories. For example if you create a virtual directory that maps
to a network share (or redirect to some local location), using
Server.MapPath will return the appropriate location (while the Path.Combine
method will return an improper location as it always assume that it is under
the web site root)
For example :
- create a site in c:\inetpub\wwwroot
- create an image directory below
- create a shared virtual dir "test" that maps to c:\tmp
Path.Combine(AppDomain.CurrentDomain.BaseDirectory , "\images"); and
Server.MapPath("/images") will return "c:\inetpub\wwwroot\images")
Path.Combine(AppDomain.CurrentDomain.BaseDirectory , "\test"); will return
"c:\inetpub\wwwroot\test" while Server.MapPath("/test") will return
"c:\temp")
Server.MapPath("~/test") will return the same path.
Now if you move this site in a "subweb" directory Server.MapPath("/images")
will still return "c:\inetpub\wwwroot\images" as this is related to the web
site root while server.MapPath("~/images") will return
"c:\inetpub\wwwroot\subweb\images" as this is related to the web application
root.
--
Patrice
"brett" <ac*****@cygen.coma écrit dans le message de news:
11**********************@j44g2000cwa.googlegroups. com...
This is what I want:
Path.Combine(AppDomain.CurrentDomain.BaseDirectory , myRelativePath);