|
Posted by
Paul Fox
on
03-22-2005 7:32
|
How To Locate a File on The Server and Get The Physical File Name given the relative location of the file.
1. Locate the Application Rooth with Me.Page.Request.PhysicalApplicationPath from an ASP.NET Page
2. If the code is executing in a class, which is not a codebehind class, use System.Web.HttpContext.Current.Request.ApplicationPath() to locate the IIS Application Root .
3. Add the relative file name to the IIS Application Root.
Public Function GetAttachmentFilePathFromXML(ByVal xmlFileName As String) As String
Dim _Path As String = Me.Page.Request.PhysicalApplicationPath
Dim pos As Integer = _Path.LastIndexOf("\")
_Path = (Left(_Path, pos) & "\" & xmlFileName)
Return _Path
End Function
|
|