MapPath/PhysicalApplicationPath change on reload

I

IDC

Hi,
I have a problem accessing files in my ASP.NET 3.5 project after I publish
it. When I load a page for the first time Request.PhysicalApplicationPath
returns the correct directory (C:\inetpub\wwwroot\...) but on reloading the
page (or accessing the same page with different parameters) I end up getting
c:\windows\system32\inetsrv\...
Of course File.Exists() fails for that directory. Is there a way (other than
hardcoding) to always get the real physical application path
(C:\inetpub\wwwroot\...) so I can check it's subdirectories for necessary
files?

Thanx.
 
I

IDC

Peter Bromberg said:
This doesn't compute. There must be something else going on, because
Server.MapPath can *only* return a physical path that lies in the web
application vroot.

It's the function I use and the result I get :-/
 
I

IDC

The code behind file contains:
protected void Page_Load(object sender, EventArgs e)
{
....
if (System.IO.File.Exists(Server.MapPath("videodata/c123.xml")))
{
....
}
....
}

works fine the first time this page is loaded but on a reload it crashes with:
Could not find a part of the path
"c:\windows\system32\inetsrv\videodata\123.xml"
 
I

IDC

The code behind file contains:
protected void Page_Load(object sender, EventArgs e)
{
....
if (System.IO.File.Exists(Server.MapPath("videodata/c123.xml")))
{
....
}
....
}

works fine the first time this page is loaded but on a reload it crashes with:
Could not find a part of the path
"c:\windows\system32\inetsrv\videodata\123.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

Forum statistics

Threads
473,764
Messages
2,569,564
Members
45,039
Latest member
CasimiraVa

Latest Threads

Top