How To Locate a File on The IIS Server and Get The Physical File Name
ASP.NET
Thread Starter: Paul Fox
Started: 03-22-2005 7:32
Replies: 0

Ireland .NET Developer Alliance :: Forums » Technologies » ASP.NET » How To Locate a File on The IIS Server and Get The Physical File Name
« Previous Thread Next Thread »
   22 Mar 2005, 7:32
Paul Fox is not online. Last active: 25/03/2005 15:10:05 Paul Fox

Top 10 Posts
Joined on 03-11-2005
Posts 9
How To Locate a File on The IIS Server and Get The Physical File Name
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
  
  Page 1 of 1 (1 items)
Ireland .NET Developer Alliance :: Forums » Technologies » ASP.NET » How To Locate a File on The IIS Server and Get The Physical File Name

Powered by Community Server :: Forums