CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Sep 2002
    Posts
    206

    need help with getting asp.net webserver current directory

    I am trying to save a file to one of the folders in the webserver, where the asp.net files are deployed. On my dev pc, I used Environment.CurrentDirecotory and Directory.CurrentDirectory. I get the following values

    "C:\\Program Files\\Microsoft Visual Studio 8\\Common7\\IDE"



    I assume this will not be the value when the code is executed on the webserver. Originally, I thought the return path is where the aspx file was located and the correct path is something like this..."../folder/file.txt"


    How do I get the correct folder path on the server or how about to approach the problem?

    thanks..

  2. #2
    Join Date
    Sep 2008
    Location
    Netherlands
    Posts
    865

    Re: need help with getting asp.net webserver current directory

    I think (i am not sure) that the visual studio webserver is located in "C:\\Program Files\\Microsoft Visual Studio 8\\Common7\\IDE".

  3. #3
    Join Date
    Jul 2008
    Posts
    21

    Re: need help with getting asp.net webserver current directory

    Hi, as far as I have understood your problem, why don't you try to use the Server.MapPath() method to store the data. Also if you are viewing the path only, then you can use the Request.ServerVariables method to find the exact path and use it for storing the data. The use of the appropriate server variable can be checked when you put the trace="true" in the page directive.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured