0

We have a .Net application, and we have three exactly same copies of it. One for development on our server, and a test and a live one on our client's server. We have to create pdf files on the server, and save them in a specified folder. It works fine on the dev and the test apps, but doesn't on the live. When it should save the file, it jumps one folder upward.

I've played for a while with server.mappath, and got the following: In the live app, if the relative path contains other than "." or "..", then it goes up one more level (the path does not contains the "LiveApplication" folder), but it works on the other ones.

Do you have any idea about this? Thank you

Live app:

xFileSystemDir:
../FileSpace/
Server.Mappath(xFileSystemDir):
C:\AppDir\FileSpace\
Server.Mappath("..\FileSpace"):
C:\AppDir\FileSpace
Server.Mappath("../FileSpace"):
C:\AppDir\FileSpace
Server.Mappath(xFileSystemDir & "Temp/" & xDir & "/" & PDFFileName):
C:\AppDir\FileSpace\Temp\PDF20130517-143114\Invoice.pdf
Server.Mappath(".")
C:\AppDir\LiveApplication\Script
Server.Mappath(".."):
C:\AppDir\LiveApplication

Test app:

xFileSystemDir:
../FileSpace/
Server.Mappath(xFileSystemDir):
C:\AppDir\TestApplication\FileSpace\
Server.Mappath("..\FileSpace"):
C:\AppDir\TestApplication\FileSpace
Server.Mappath("../FileSpace"):
C:\AppDir\TestApplication\FileSpace
Server.Mappath(xFileSystemDir & "Temp/" & xDir & "/" & PDFFileName):
C:\AppDir\TestApplication\FileSpace\Temp\PDF20130517-143442\Invoice.pdf
Server.Mappath(".")
C:\AppDir\TestApplication\Script
Server.Mappath(".."):
C:\AppDir\TestApplication

Physical folder tree on clients server:

c:\
  AppDir\
    TestApplication\
      FileSpace\
        Temp\ - here goes the new files
    LiveApplication
      FileSpace\
        Temp\ - the new files should be created here
    FileSpace\ - this folder should not exists, but the live app creates the new files here
      Temp\
Gomez0
  • 41
  • 2

1 Answers1

0

Sounds like your website is running in C:\AppDir rather than C:\AppDir\LiveApplication. Have you examined HttpRuntime.AppDomainAppPath to see if its being set incorrectly somewhere.

Jay Zelos
  • 1,409
  • 1
  • 9
  • 10