Control.MapPathSecure Method (String)
Retrieves the physical path that a virtual path, either absolute or relative, maps to.
Assembly: System.Web (in System.Web.dll)
This method can only be used by server controls that have permissions to read files and which are part of fully trusted .dll files, such as System.Web.dll. This helps prevent security breaches.
// An HttpException occurs if the server control does not,; // have permissions to read the resulting mapped file. output.Write("The Actual Path of the virtual directory : "+ MapPathSecure(TemplateSourceDirectory)+"<br>"); // Get all the files from the absolute path of 'MyControl'; // using TemplateSourceDirectory which gives the virtual Directory. string  myFiles= Directory.GetFiles(MapPathSecure(TemplateSourceDirectory)); output.Write("The files in this Directory are <br>"); // List all the files. for (int i=0;i<myFiles.Length;i++) output.Write(myFiles[i]+"<br>");
Available since 1.1