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.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.
-- Pete
Site: http://www.eggheadcafe.com
UnBlog: http://petesbloggerama.blogspot.com
MetaFinder: http://www.blogmetafinder.com
"IDC" wrote:
> 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 th
e
> page (or accessing the same page with different parameters) I end up getti
ng
> c:\windows\system32\inetsrv\...
> Of course File.Exists() fails for that directory. Is there a way (other th
an
> hardcoding) to always get the real physical application path
> (C:\inetpub\wwwroot\...) so I can check it's subdirectories for necessary
> files?
> Thanx.
"Peter Bromberg [C# MVP]" wrote:
> 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 :-/
Post "just enough" working sample code for a helpful reader to be able to
reconstruct your issue.
-- Peter
Site: http://www.eggheadcafe.com
UnBlog: http://petesbloggerama.blogspot.com
MetaFinder: http://www.blogmetafinder.com
"IDC" wrote:
>
> "Peter Bromberg [C# MVP]" wrote:
> It's the function I use and the result I get :-/
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 wit
h:
Could not find a part of the path
" c:\windows\system32\inetsrv\videodata\12
3.xml"
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 wit
h:
Could not find a part of the path
" c:\windows\system32\inetsrv\videodata\12
3.xml"
0 comments:
Post a Comment