How to access website root

Back

Sometimes your application needs to access underlying file-system, maybe to write a file or to store data.

If you are using ASP.NET, you can access your home root folder (and from there, all subfolders) using common "~/" notation where that address represents your root folder and a subfolder can be expressed as "~/subfolder". That address must then be converted to a physical address via Server.MapPath function.

If you are using PHP, you can retrieve root folder physical path via $_SERVER['DOCUMENT_ROOT'] environment variable.

Was this article helpful?
Dislike0 Like0

Views: 1270

Powered by HostBill