Get the full file path

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
 
G

Guest

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")
 
K

Ken

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?
 
G

Guest

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
 
G

Guest

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?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,236
Members
46,825
Latest member
VernonQuy6

Latest Threads

Top