Get the full file path

  • Thread starter Thread starter Ken
  • Start date Start date
K

Ken

I have application files under "C:\$\TestApp".
there is a test.xml file under "C:\$\TestApp\test.xml"
I made a virtural directory in IIS as "TestApp"

currently in application, "Request.MapPath( string)" is used to get the full
filepath.
the result is like @"c:\inetpub\wwwroot\TestApp\test.xml"
but the real path is @"c:$\TestApp\test.xml".

What should I use to get the real path?

Thanks
 
I have application files under "C:\$\TestApp".
there is a test.xml file under "C:\$\TestApp\test.xml"
I made a virtural directory in IIS as "TestApp"

currently in application, "Request.MapPath( string)" is used to get the full
filepath.
the result is like @"c:\inetpub\wwwroot\TestApp\test.xml"
but the real path is @"c:$\TestApp\test.xml".

What should I use to get the real path?

Thanks

Request.MapPath("/TestApp/test.xml")
 
I currently used that way- Request.MapPath("/TestApp/test.xml").
that is why I got @"c:\inetpub\wwwroot\TestApp\test.xml"
however, that is not correct file path.
real filepath is "C:\$\TestApp\test.xml"
What should I use to get the real path?
 
I currently used that way- Request.MapPath("/TestApp/test.xml").
that is why I got @"c:\inetpub\wwwroot\TestApp\test.xml"
however, that is not correct file path.
real filepath is "C:\$\TestApp\test.xml"
What should I use to get the real path?

Ken, actually, I think it should give the real path. Try to make
iisreset (Start - Run) and see what happens
 
No help.

Thanks through

Ken

I tried to test the same config on my box and I've found that once the
virtual directory is changed and pointed to another directory, the
Request.MapPath() method is still getting an old path. After iisreset
it's starting to get the new path. This is a reason why I've told you
about iisreset utility.

Well... what else? Are you sure that the directory has been correctly
configured? Is the file accessible when you open it in a browser
http://localhost/TestApp/test.xml?
 
Back
Top