Groups > Asp .Net > Getting started with ASP.NET > Re: Help please! "Failed to map the path " error.




Help please! "Failed to map the path " error.

Help please! "Failed to map the path " error.
Thu, 3 Apr 2008 21:52:49 +0000
I am using VS.NET 2005 and Windows XP. I set up a virtual direcotry called
"myAMS" which is pointing to C:/MYAPPS/AMS". But when I tried to
run my project, I always got the following error:

Failed to map the path '/myAMS/'.

This error was thrown by the following line of code:

string sLoginXML = Server.MapPath(gvp.getVirtualPath(ci.GetLoginPathName()));

Can any one help me figure out what happened. Thanks a lot.
Post Reply
Re: Help please! "Failed to map the path " error.
Thu, 3 Apr 2008 22:46:04 +0000
What are the gvp and ci objects?  What value is ci.GetLoginPathName()
returning?
Post Reply
Re: Help please! "Failed to map the path " error.
Thu, 3 Apr 2008 23:01:23 +0000
Thanks for reply. The gvp and ci are two ojbects. The ci.GetLoginPathName()
returns http://localhost/myAMS, then gvp object will process this path and
returns "/myAMS" as the parameter of Server.MapPath function.

Basically, that line of code can be translated into this:

string sLoginXML = Server.MapPath("/myAMS"/);

But, very strange, when I used those two objects (gvp and ci) to pass the path
to the Server.Mappath function, I got "Failed to map path
"/myAMS" error, but when I just hard coded the "/myAMS/" as
the parameter of this Server.mappath function, it didn't give me error but
returned me "c:/myAMS" instead of the correct path
"c:/MYAPPS/myAMS". Why? I am lost.
Post Reply
Re: Help please! "Failed to map the path " error.
Thu, 3 Apr 2008 23:02:57 +0000
Sorry, Typo. The code should be like this:

string sLoginXML = Server.MapPath("/myAMS/");
Post Reply
Re: Help please! "Failed to map the path " error.
Thu, 3 Apr 2008 23:10:34 +0000
Try Server.MapPath("/")

MapPath is looking for a literal folder (or path) name, but you're passing it a
virtual path.
Post Reply
<< Previous 1 2 Next >>
( Page 1 of 2 )
about | contact