Read/Write to folder *above* site root

K

Kenny

If MapPath is the way to go, then how can I reference the desired folder as
relative to the current site's root (I don't want to hard-code the path from
the C:\root folder). FWIW the logic that does the read/writing is in a
middle tier component (not in a code-behind module).

Suppose I need to write to the WriteHere folder:

C:\WebSites\Site52\WriteHere\

and the site root is elsewhere:
C:\WebSites\Site52\Sites\SiteRootHere\

Thanks for helping.
 
P

Patrice

Get the root (using MapPath or ApplicationPath) and use .. so thatyou build
a string such as :

C:\WebSites\Site52\Sites\SiteRootHere\..\WriteHere

You could also have this info in the web.config file...

Patrice
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,581
Members
45,057
Latest member
KetoBeezACVGummies

Latest Threads

Top