Why not use the method that works? The old method doesn't work because a
path beginning with a forward-slash is a site-root relative path. An ASP.Net
application is not a (web) site root. It is simply a designation of a
virtual directory as housing resources that will be processed in the same
application domain (memory space). The tilde ('~') indicates that the path
is relative to the application root.
--
HTH,
Kevin Spencer
Microsoft MVP
Software Composer
http://unclechutney.blogspot.com
The shortest distance between 2 points is a curve.
"MichiMichi" <ww*****@gmx.chwrote in message
news:11**********************@q2g2000cwa.googlegro ups.com...
I want to reach the root folder of my web application.
Response.Write(Server.MapPath("~") works fine but I thought it also
would work with Response.Write(Server.MapPath("/") but it doesnt?
It works on IIS but not with the intern web server of VS2005
On Feb 12, 4:49 am, Göran Andersson <g...@guffa.comwrote:
MichiMichi wrote:
When using Server.MapPath on IIS 5 on my localhost everything works
well. All of the following commands are executed without any error
Response.Write(Server.MapPath("/app_test") & "<br>")
Response.Write(Server.MapPath("app_test") & "<br>")
Response.Write(Server.MapPath("~") & "<br>")
However, running the first statement on via the internal Visual Studio
2005 Server I receive an error for
Server.MapPath("/app_test")
Source File: C:\Documents and Settings\machine.namei\My Documents
\Visual Studio 2005\WebSites\testing\phishingPics\Default2.aspx.v b
Line: 10
Stack Trace:
[InvalidOperationException: Failed to map the path '/app_test'.]
System.Web.Hosting.HostingEnvironment.MapPathActua l(VirtualPath
virtualPath, Boolean permitNull) +3521356
System.Web.VirtualPath.MapPathInternal() +41
System
What can I do to make this work on my testing enviroment with the
light weight webserver on Visual Studio 2005
Do you need to use that exact path? What folder is it that you want to
reach?
--
Göran Andersson
_____http://www.guffa.com