The correct/advised way to loading a file from the server

Discussion in 'ASP.NET / ASP.NET Core' started by Razor, Jul 23, 2005.

Thread Status:
Threads that have been inactive for 5 years or longer are closed to further replies. Please start a new thread.
  1. Hello,

    I am planning on loading html files depending on what options are picked and then placing them into a label control (yup it can be done :) ). However, I noticed that if I use the Directory class <txtTest.Text=Directory.GetCurrentDirectory().ToString();> to get the current directory it responds with the following:



    c:\windows\system32\inetsrv


    Obviously it is unlikely that my webhome directory root is at that location so if possible -Iwould liketo either load files using an offset command (offset from my 'home/web' directory) or I need to know the exact path of my web storage root directory. Hopefully the former otherwise the code will fail if my webhome storage point is moved to a different location.


    Any help would be very much appreciated. :)





    Mark
     
  2. Never mind thanks anyway, found it

    for future reference

    Request.ServerVariables["APPL_PHYSICAL_PATH"]

    eg

    StreamReader srRdr=new StreamReader(Request.ServerVariables["APPL_PHYSICAL_PATH"]+"\\PathofFile.ext");

    Cheers

    Mark

    Post Edited (Razor) : 7/23/2005 3:16:48 PM GMT
     
  3. Bruce

    Bruce DiscountASP.NET Staff

Thread Status:
Threads that have been inactive for 5 years or longer are closed to further replies. Please start a new thread.

Share This Page