Showing posts with label folder. Show all posts
Showing posts with label folder. Show all posts

Saturday, March 31, 2012

Server Side Folder Browser... Please

Hi All ...
This is first time I am Posting some thing to some site.
I realy need a help frm some body.....
I want to create a page which displays the local server folders to the user
I mean i want a folder browser on my asp.net page.
Can any body help me ?


For retrieving the folder system you should write recursive functions in order to retrieve all the folders, subfolders and files from the server.
Displaying the information can be alittle tricky. Most suitable solution is to use a Treeview component. Check the Control gallery section of this website in the navigation controls...
there are some treeview controls.
The choice of how you will display the information will affect the way you will return the information from your recursive functions...
Check this article for an example:http://www.csharpfriends.com/Articles/getArticle.aspx?articleID=109
Good Luck

Monday, March 26, 2012

Server side-error occurred on sending debug HTTP request.

I got a new machine this week. Prior to that, I backed up my WWWROOT folder.

Now I have the new machine, moved my files back.

I have one projet, though, that refuses to debug/launch:

================================================
Error while trying to run project: Unable to start debugging on the web
server. Server side-error occurred on sending debug HTTP request.

Make sure the server is operating correctly. Verify there are no syntax
errors in web.config by doing a Debug.Start Without Debugging. You may also
want to refer to the ASP.NET and ATL Server debugging topic in the online
documentation.
================================================

According to MS, the likely cause is a bad web.config file. However, this is
the same file that worked on my last machine, and it's the exact same file
currently running on our live server just fine.

So, could there be another culprit here? Anything else I should look at?

-DarrelIs your IIS configured right... You have to config your folder as a
application folder in the IIS
"darrel" <notreal@.nowhere.com> escreveu na mensagem
news:eVOxrZb1FHA.3256@.TK2MSFTNGP09.phx.gbl...
>I got a new machine this week. Prior to that, I backed up my WWWROOT
>folder.
> Now I have the new machine, moved my files back.
> I have one projet, though, that refuses to debug/launch:
> ================================================
> Error while trying to run project: Unable to start debugging on the web
> server. Server side-error occurred on sending debug HTTP request.
> Make sure the server is operating correctly. Verify there are no syntax
> errors in web.config by doing a Debug.Start Without Debugging. You may
> also want to refer to the ASP.NET and ATL Server debugging topic in the
> online documentation.
> ================================================
> According to MS, the likely cause is a bad web.config file. However, this
> is the same file that worked on my last machine, and it's the exact same
> file currently running on our live server just fine.
> So, could there be another culprit here? Anything else I should look at?
> -Darrel
Is it possible that you had the Web declared as an Application in IIS but
you have done that on the new machine?

Ken

Microsoft MVP [ASP.NET]

"darrel" <notreal@.nowhere.com> wrote in message
news:eVOxrZb1FHA.3256@.TK2MSFTNGP09.phx.gbl...
>I got a new machine this week. Prior to that, I backed up my WWWROOT
>folder.
> Now I have the new machine, moved my files back.
> I have one projet, though, that refuses to debug/launch:
> ================================================
> Error while trying to run project: Unable to start debugging on the web
> server. Server side-error occurred on sending debug HTTP request.
> Make sure the server is operating correctly. Verify there are no syntax
> errors in web.config by doing a Debug.Start Without Debugging. You may
> also want to refer to the ASP.NET and ATL Server debugging topic in the
> online documentation.
> ================================================
> According to MS, the likely cause is a bad web.config file. However, this
> is the same file that worked on my last machine, and it's the exact same
> file currently running on our live server just fine.
> So, could there be another culprit here? Anything else I should look at?
> -Darrel
> Is your IIS configured right... You have to config your folder as a
> application folder in the IIS

Yea. I dunno what happened. I destroyed all my project files, made a new
project, reimported all the files (including the web.config) and things were
back to normal.

Must have been a VS.net bug.

Surprise. ;o)

-Darrel

Server side-error occurred on sending debug HTTP request.

I got a new machine this w. Prior to that, I backed up my WWWROOT folder.
Now I have the new machine, moved my files back.
I have one projet, though, that refuses to debug/launch:
========================================
========
Error while trying to run project: Unable to start debugging on the web
server. Server side-error occurred on sending debug HTTP request.
Make sure the server is operating correctly. Verify there are no syntax
errors in web.config by doing a Debug.Start Without Debugging. You may also
want to refer to the ASP.NET and ATL Server debugging topic in the online
documentation.
========================================
========
According to MS, the likely cause is a bad web.config file. However, this is
the same file that worked on my last machine, and it's the exact same file
currently running on our live server just fine.
So, could there be another culprit here? Anything else I should look at?
-DarrelIs your IIS configured right... You have to config your folder as a
application folder in the IIS
"darrel" <notreal@.nowhere.com> escreveu na mensagem
news:eVOxrZb1FHA.3256@.TK2MSFTNGP09.phx.gbl...
>I got a new machine this w. Prior to that, I backed up my WWWROOT
>folder.
> Now I have the new machine, moved my files back.
> I have one projet, though, that refuses to debug/launch:
> ========================================
========
> Error while trying to run project: Unable to start debugging on the web
> server. Server side-error occurred on sending debug HTTP request.
> Make sure the server is operating correctly. Verify there are no syntax
> errors in web.config by doing a Debug.Start Without Debugging. You may
> also want to refer to the ASP.NET and ATL Server debugging topic in the
> online documentation.
> ========================================
========
> According to MS, the likely cause is a bad web.config file. However, this
> is the same file that worked on my last machine, and it's the exact same
> file currently running on our live server just fine.
> So, could there be another culprit here? Anything else I should look at?
> -Darrel
>
Is it possible that you had the Web declared as an Application in IIS but
you have done that on the new machine?
Ken
Microsoft MVP [ASP.NET]
"darrel" <notreal@.nowhere.com> wrote in message
news:eVOxrZb1FHA.3256@.TK2MSFTNGP09.phx.gbl...
>I got a new machine this w. Prior to that, I backed up my WWWROOT
>folder.
> Now I have the new machine, moved my files back.
> I have one projet, though, that refuses to debug/launch:
> ========================================
========
> Error while trying to run project: Unable to start debugging on the web
> server. Server side-error occurred on sending debug HTTP request.
> Make sure the server is operating correctly. Verify there are no syntax
> errors in web.config by doing a Debug.Start Without Debugging. You may
> also want to refer to the ASP.NET and ATL Server debugging topic in the
> online documentation.
> ========================================
========
> According to MS, the likely cause is a bad web.config file. However, this
> is the same file that worked on my last machine, and it's the exact same
> file currently running on our live server just fine.
> So, could there be another culprit here? Anything else I should look at?
> -Darrel
>
> Is your IIS configured right... You have to config your folder as a
> application folder in the IIS
Yea. I dunno what happened. I destroyed all my project files, made a new
project, reimported all the files (including the web.config) and things were
back to normal.
Must have been a VS.net bug.
Surprise. ;o)
-Darrel

Server Transfer To Windows Forms Authenticated Application

Hello,

I am having a really strange issue, I have folder containing an ASP.NET
application. (The folder's name is Web) The root directory of the whole
site I have an Index.aspx page that contains:

<%
Server.Transfer("Web\Default.aspx")
%
The web config file in the Web directory is using an Authentication mode of
Forms. For some reason when the transfer method is called, it thows an:

Parser Error Message: It is an error to use a section registered as
allowDefinition='MachineToApplication' beyond application level. This error
can be caused by a virtual directory not being configured as an application
in IIS.

I am running on a shared server, and can't really make it a virtual
directory. Does anyone know a way around this? Could I make it a subweb or
does this need to be a virtual directory?

Thanks.Hi Ryan,

what i understand from your description that u are maintaining a web.config
file in a sub dir also.
Actually Authenticate Mode can only be defined in the application wide
web.config file .

I suggest you remove the Authentication element from the web.config file and
then try running your application. In case you still find errors, try
removing the sessionState and authorization elements as well because they are
also set at application level.

In case you only wish to use Authentication mode as forms, you may have to
create a virtual dir.

HTH

"Ryan" wrote:

> Hello,
> I am having a really strange issue, I have folder containing an ASP.NET
> application. (The folder's name is Web) The root directory of the whole
> site I have an Index.aspx page that contains:
> <%
> Server.Transfer("Web\Default.aspx")
> %>
> The web config file in the Web directory is using an Authentication mode of
> Forms. For some reason when the transfer method is called, it thows an:
> Parser Error Message: It is an error to use a section registered as
> allowDefinition='MachineToApplication' beyond application level. This error
> can be caused by a virtual directory not being configured as an application
> in IIS.
> I am running on a shared server, and can't really make it a virtual
> directory. Does anyone know a way around this? Could I make it a subweb or
> does this need to be a virtual directory?
> Thanks.

Server Transfer To Windows Forms Authenticated Application

Hello,
I am having a really strange issue, I have folder containing an ASP.NET
application. (The folder's name is Web) The root directory of the whole
site I have an Index.aspx page that contains:
<%
Server.Transfer("Web\Default.aspx")
%>
The web config file in the Web directory is using an Authentication mode of
Forms. For some reason when the transfer method is called, it thows an:
Parser Error Message: It is an error to use a section registered as
allowDefinition='MachineToApplication' beyond application level. This error
can be caused by a virtual directory not being configured as an application
in IIS.
I am running on a shared server, and can't really make it a virtual
directory. Does anyone know a way around this? Could I make it a subweb or
does this need to be a virtual directory?
Thanks.Hi Ryan,
what i understand from your description that u are maintaining a web.config
file in a sub dir also.
Actually Authenticate Mode can only be defined in the application wide
web.config file .
I suggest you remove the Authentication element from the web.config file and
then try running your application. In case you still find errors, try
removing the sessionState and authorization elements as well because they ar
e
also set at application level.
In case you only wish to use Authentication mode as forms, you may have to
create a virtual dir.
HTH
"Ryan" wrote:

> Hello,
> I am having a really strange issue, I have folder containing an ASP.NET
> application. (The folder's name is Web) The root directory of the whole
> site I have an Index.aspx page that contains:
> <%
> Server.Transfer("Web\Default.aspx")
> %>
> The web config file in the Web directory is using an Authentication mode o
f
> Forms. For some reason when the transfer method is called, it thows an:
> Parser Error Message: It is an error to use a section registered as
> allowDefinition='MachineToApplication' beyond application level. This erro
r
> can be caused by a virtual directory not being configured as an applicatio
n
> in IIS.
> I am running on a shared server, and can't really make it a virtual
> directory. Does anyone know a way around this? Could I make it a subweb
or
> does this need to be a virtual directory?
> Thanks.
>

Saturday, March 24, 2012

server unavailable error with no messages in event viewer

I have an application that was originally in asp but is now moved to
ASP.Net. To deploy it, I just changed the default file in IIS for the
web folder to point to the new aspx file. Occasionally I see a "Server
unavailable" error. There is nothing in the event log that suggests any
related error or warnings. This application also has a part of it that
is still in ASP, would that cause any issues?
Most of the links online for this error are about application pool but
I see no messages in the event log, so I dont think that is an issue.
Thanks for any ideas.
PritiTry re installing ASPNET using commands -i to install and -u to uninstall
and then restart IIS
Can't remember the commands.
Patrick
<pphadke@.gmail.com> wrote in message
news:1134153210.219405.269640@.g43g2000cwa.googlegroups.com...
> I have an application that was originally in asp but is now moved to
> ASP.Net. To deploy it, I just changed the default file in IIS for the
> web folder to point to the new aspx file. Occasionally I see a "Server
> unavailable" error. There is nothing in the event log that suggests any
> related error or warnings. This application also has a part of it that
> is still in ASP, would that cause any issues?
> Most of the links online for this error ayre about application pool but
> I see no messages in the event log, so I dont think that is an issue.
> Thanks for any ideas.
> Priti
>

Tuesday, March 13, 2012

Server.mappath

Hi,
if I write this code to retrieve a folder on the server
Server.mappath("/DATA")
I get this error message
System.InvalidOperationException: Failed to map the path '/DATA'
the virtual folder for my webApp is not situated in Inetpub, nor is the DATA
folder that I would like to retrieve
anybody an idea
thx"benoit" wrote:

> if I write this code to retrieve a folder on the server
> Server.mappath("/DATA")
> I get this error message
> System.InvalidOperationException: Failed to map the path '/DATA'
> the virtual folder for my webApp is not situated in Inetpub, nor is the
> DATA
> folder that I would like to retrieve
I doesn't need to be in Inetpub.
Is "data" the name of a folder inside your webapp? If so, shouldn't your
line read Server.mappath("/WebApp/Data") ?
Steven
- - -
Benoit,
Server.MapPath(...) works starting at the IIS Virtual directory root of the
currently running application page.
It does not work for folders anywhere outside the IIS Vroot of the current
application.
What is it that you are trying to accomplish?
Peter
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com
"benoit" wrote:

> Hi,
> if I write this code to retrieve a folder on the server
> Server.mappath("/DATA")
> I get this error message
> System.InvalidOperationException: Failed to map the path '/DATA'
> the virtual folder for my webApp is not situated in Inetpub, nor is the DA
TA
> folder that I would like to retrieve
> anybody an idea
> thx
Well
On ASP.NET 1.1 I had two webapps on the same server
/WNW
and
/Data
/Data was a virtual folder in which images and Xml are stored.
With Server.MapPath("/Data") i could without any problem read my Xml and
images.
Since I made the move to ASP.Net 2.0, I am no longer able to retrieve my
data the way I used to
"Peter Bromberg [C# MVP]" wrote:
> Benoit,
> Server.MapPath(...) works starting at the IIS Virtual directory root of th
e
> currently running application page.
> It does not work for folders anywhere outside the IIS Vroot of the current
> application.
> What is it that you are trying to accomplish?
> Peter
> --
> Co-founder, Eggheadcafe.com developer portal:
> http://www.eggheadcafe.com
> UnBlog:
> http://petesbloggerama.blogspot.com
>
>
> "benoit" wrote:
>
"benoit" wrote:

> On ASP.NET 1.1 I had two webapps on the same server
> /WNW
> and
> /Data
> /Data was a virtual folder in which images and Xml are stored.
> With Server.MapPath("/Data") i could without any problem read my Xml and
> images.
> Since I made the move to ASP.Net 2.0, I am no longer able to retrieve my
> data the way I used to
IIRC, this is a security issue. What about putting a virtual dir in /WNW
called "Data" that points to the same location as /Data? That way you can
use Server.MapPath("/WNW/Data");
Steven
- - -
That's strange.
I can retrieve physical paths by using Server.MapPath("/virtualDir")
without any problem.
mappath.aspx:
--
<%@. Page Language="VB" %>
<script language = "VB" runat = "server">
Sub Page_Load(ByVal obj As Object, ByVal e As EventArgs)
Dim x As String = Server.MapPath("/SomeApp")
Label1.Text = "The physical directory for /SomeApp is : " & x
End Sub
</script>
<html>
<head runat="server">
<title>Server.MapPath</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:Label ID="Label1" runat="server"></asp:Label><br/>
</div>
</form>
</body>
</html>
--
Juan T. Llibre, asp.net MVP
aspnetfaq.com : http://www.aspnetfaq.com/
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en espaol : http://asp.net.do/foros/
===================================
"benoit" <benoit@.discussions.microsoft.com> wrote in message
news:DFDBDCA4-291C-437B-96C8-9C7DD43B7A18@.microsoft.com...
> Well
> On ASP.NET 1.1 I had two webapps on the same server
> /WNW
> and
> /Data
> /Data was a virtual folder in which images and Xml are stored.
> With Server.MapPath("/Data") i could without any problem read my Xml and
> images.
> Since I made the move to ASP.Net 2.0, I am no longer able to retrieve my
> data the way I used to
>
>
> "Peter Bromberg [C# MVP]" wrote:
>
I noticed that when i teste the app in the past the address
was http://localhost/MyApp/...
and now http://localhost:someport/MyApp
Does it have something to do with that?
"Juan T. Llibre" wrote:

> That's strange.
> I can retrieve physical paths by using Server.MapPath("/virtualDir")
> without any problem.
> mappath.aspx:
> --
> <%@. Page Language="VB" %>
> <script language = "VB" runat = "server">
> Sub Page_Load(ByVal obj As Object, ByVal e As EventArgs)
> Dim x As String = Server.MapPath("/SomeApp")
> Label1.Text = "The physical directory for /SomeApp is : " & x
> End Sub
> </script>
> <html>
> <head runat="server">
> <title>Server.MapPath</title>
> </head>
> <body>
> <form id="form1" runat="server">
> <div>
> <asp:Label ID="Label1" runat="server"></asp:Label><br/>
> </div>
> </form>
> </body>
> </html>
> --
>
> Juan T. Llibre, asp.net MVP
> aspnetfaq.com : http://www.aspnetfaq.com/
> asp.net faq : http://asp.net.do/faq/
> foros de asp.net, en espa?ol : http://asp.net.do/foros/
> ===================================
> "benoit" <benoit@.discussions.microsoft.com> wrote in message
> news:DFDBDCA4-291C-437B-96C8-9C7DD43B7A18@.microsoft.com...
>
>
re:
> Does it have something to do with that?
Server.MapPath returns the correct physical directory regardless of whether
you use the built-in server in the VS IDE, or whether you use IIS to view th
e page.
All it needs is a valid relative URL ( a virtual path ).
Juan T. Llibre, asp.net MVP
aspnetfaq.com : http://www.aspnetfaq.com/
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en espaol : http://asp.net.do/foros/
===================================
"benoit" <benoit@.discussions.microsoft.com> wrote in message
news:932A4245-78F3-403C-BCDE-CC1110C31B94@.microsoft.com...
>I noticed that when i teste the app in the past the address
> was http://localhost/MyApp/...
> and now http://localhost:someport/MyApp
> Does it have something to do with that?
> "Juan T. Llibre" wrote:
>

Server.mappath

Hi,

if I write this code to retrieve a folder on the server
Server.mappath("/DATA")

I get this error message
System.InvalidOperationException: Failed to map the path '/DATA'

the virtual folder for my webApp is not situated in Inetpub, nor is the DATA
folder that I would like to retrieve

anybody an idea

thx"benoit" wrote:

> if I write this code to retrieve a folder on the server
> Server.mappath("/DATA")
> I get this error message
> System.InvalidOperationException: Failed to map the path '/DATA'
> the virtual folder for my webApp is not situated in Inetpub, nor is the
> DATA
> folder that I would like to retrieve

I doesn't need to be in Inetpub.

Is "data" the name of a folder inside your webapp? If so, shouldn't your
line read Server.mappath("/WebApp/Data") ?

Steven

- - -
Benoit,
Server.MapPath(...) works starting at the IIS Virtual directory root of the
currently running application page.
It does not work for folders anywhere outside the IIS Vroot of the current
application.

What is it that you are trying to accomplish?
Peter

--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com

"benoit" wrote:

> Hi,
> if I write this code to retrieve a folder on the server
> Server.mappath("/DATA")
> I get this error message
> System.InvalidOperationException: Failed to map the path '/DATA'
> the virtual folder for my webApp is not situated in Inetpub, nor is the DATA
> folder that I would like to retrieve
> anybody an idea
> thx
Well

On ASP.NET 1.1 I had two webapps on the same server
/WNW
and
/Data

/Data was a virtual folder in which images and Xml are stored.
With Server.MapPath("/Data") i could without any problem read my Xml and
images.
Since I made the move to ASP.Net 2.0, I am no longer able to retrieve my
data the way I used to

"Peter Bromberg [C# MVP]" wrote:

> Benoit,
> Server.MapPath(...) works starting at the IIS Virtual directory root of the
> currently running application page.
> It does not work for folders anywhere outside the IIS Vroot of the current
> application.
> What is it that you are trying to accomplish?
> Peter
> --
> Co-founder, Eggheadcafe.com developer portal:
> http://www.eggheadcafe.com
> UnBlog:
> http://petesbloggerama.blogspot.com
>
>
> "benoit" wrote:
> > Hi,
> > if I write this code to retrieve a folder on the server
> > Server.mappath("/DATA")
> > I get this error message
> > System.InvalidOperationException: Failed to map the path '/DATA'
> > the virtual folder for my webApp is not situated in Inetpub, nor is the DATA
> > folder that I would like to retrieve
> > anybody an idea
> > thx
"benoit" wrote:

> On ASP.NET 1.1 I had two webapps on the same server
> /WNW
> and
> /Data
> /Data was a virtual folder in which images and Xml are stored.
> With Server.MapPath("/Data") i could without any problem read my Xml and
> images.
> Since I made the move to ASP.Net 2.0, I am no longer able to retrieve my
> data the way I used to

IIRC, this is a security issue. What about putting a virtual dir in /WNW
called "Data" that points to the same location as /Data? That way you can
use Server.MapPath("/WNW/Data");

Steven

- - -
That's strange.

I can retrieve physical paths by using Server.MapPath("/virtualDir")
without any problem.

mappath.aspx:
------
<%@. Page Language="VB" %>
<script language = "VB" runat = "server">
Sub Page_Load(ByVal obj As Object, ByVal e As EventArgs)
Dim x As String = Server.MapPath("/SomeApp")
Label1.Text = "The physical directory for /SomeApp is : " & x
End Sub
</script>
<html>
<head runat="server">
<title>Server.MapPath</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:Label ID="Label1" runat="server"></asp:Label><br/>
</div>
</form>
</body>
</html>
------

Juan T. Llibre, asp.net MVP
aspnetfaq.com : http://www.aspnetfaq.com/
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en espaol : http://asp.net.do/foros/
===================================
"benoit" <benoit@.discussions.microsoft.com> wrote in message
news:DFDBDCA4-291C-437B-96C8-9C7DD43B7A18@.microsoft.com...
> Well
> On ASP.NET 1.1 I had two webapps on the same server
> /WNW
> and
> /Data
> /Data was a virtual folder in which images and Xml are stored.
> With Server.MapPath("/Data") i could without any problem read my Xml and
> images.
> Since I made the move to ASP.Net 2.0, I am no longer able to retrieve my
> data the way I used to
>
>
> "Peter Bromberg [C# MVP]" wrote:
>> Benoit,
>> Server.MapPath(...) works starting at the IIS Virtual directory root of the
>> currently running application page.
>> It does not work for folders anywhere outside the IIS Vroot of the current
>> application.
>>
>> What is it that you are trying to accomplish?
>> Peter
>>
>> --
>> Co-founder, Eggheadcafe.com developer portal:
>> http://www.eggheadcafe.com
>> UnBlog:
>> http://petesbloggerama.blogspot.com
>>
>>
>>
>>
>> "benoit" wrote:
>>
>> > Hi,
>>> > if I write this code to retrieve a folder on the server
>> > Server.mappath("/DATA")
>>> > I get this error message
>> > System.InvalidOperationException: Failed to map the path '/DATA'
>>> > the virtual folder for my webApp is not situated in Inetpub, nor is the DATA
>> > folder that I would like to retrieve
>>> > anybody an idea
>>> > thx
I noticed that when i teste the app in the past the address
was http://localhost/MyApp/...
and now http://localhost:someport/MyApp

Does it have something to do with that?

"Juan T. Llibre" wrote:

> That's strange.
> I can retrieve physical paths by using Server.MapPath("/virtualDir")
> without any problem.
> mappath.aspx:
> ------
> <%@. Page Language="VB" %>
> <script language = "VB" runat = "server">
> Sub Page_Load(ByVal obj As Object, ByVal e As EventArgs)
> Dim x As String = Server.MapPath("/SomeApp")
> Label1.Text = "The physical directory for /SomeApp is : " & x
> End Sub
> </script>
> <html>
> <head runat="server">
> <title>Server.MapPath</title>
> </head>
> <body>
> <form id="form1" runat="server">
> <div>
> <asp:Label ID="Label1" runat="server"></asp:Label><br/>
> </div>
> </form>
> </body>
> </html>
> ------
>
> Juan T. Llibre, asp.net MVP
> aspnetfaq.com : http://www.aspnetfaq.com/
> asp.net faq : http://asp.net.do/faq/
> foros de asp.net, en espa?ol : http://asp.net.do/foros/
> ===================================
> "benoit" <benoit@.discussions.microsoft.com> wrote in message
> news:DFDBDCA4-291C-437B-96C8-9C7DD43B7A18@.microsoft.com...
> > Well
> > On ASP.NET 1.1 I had two webapps on the same server
> > /WNW
> > and
> > /Data
> > /Data was a virtual folder in which images and Xml are stored.
> > With Server.MapPath("/Data") i could without any problem read my Xml and
> > images.
> > Since I made the move to ASP.Net 2.0, I am no longer able to retrieve my
> > data the way I used to
> > "Peter Bromberg [C# MVP]" wrote:
> >> Benoit,
> >> Server.MapPath(...) works starting at the IIS Virtual directory root of the
> >> currently running application page.
> >> It does not work for folders anywhere outside the IIS Vroot of the current
> >> application.
> >>
> >> What is it that you are trying to accomplish?
> >> Peter
> >>
> >> --
> >> Co-founder, Eggheadcafe.com developer portal:
> >> http://www.eggheadcafe.com
> >> UnBlog:
> >> http://petesbloggerama.blogspot.com
> >>
> >>
> >>
> >>
> >> "benoit" wrote:
> >>
> >> > Hi,
> >> >> > if I write this code to retrieve a folder on the server
> >> > Server.mappath("/DATA")
> >> >> > I get this error message
> >> > System.InvalidOperationException: Failed to map the path '/DATA'
> >> >> > the virtual folder for my webApp is not situated in Inetpub, nor is the DATA
> >> > folder that I would like to retrieve
> >> >> > anybody an idea
> >> >> > thx
>
re:
> Does it have something to do with that?

Server.MapPath returns the correct physical directory regardless of whether
you use the built-in server in the VS IDE, or whether you use IIS to view the page.

All it needs is a valid relative URL ( a virtual path ).

Juan T. Llibre, asp.net MVP
aspnetfaq.com : http://www.aspnetfaq.com/
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en espaol : http://asp.net.do/foros/
===================================
"benoit" <benoit@.discussions.microsoft.com> wrote in message
news:932A4245-78F3-403C-BCDE-CC1110C31B94@.microsoft.com...
>I noticed that when i teste the app in the past the address
> was http://localhost/MyApp/...
> and now http://localhost:someport/MyApp
> Does it have something to do with that?

> "Juan T. Llibre" wrote:
>> That's strange.
>>
>> I can retrieve physical paths by using Server.MapPath("/virtualDir")
>> without any problem.
>>
>> mappath.aspx:
>> ------
>> <%@. Page Language="VB" %>
>> <script language = "VB" runat = "server">
>> Sub Page_Load(ByVal obj As Object, ByVal e As EventArgs)
>> Dim x As String = Server.MapPath("/SomeApp")
>> Label1.Text = "The physical directory for /SomeApp is : " & x
>> End Sub
>> </script>
>> <html>
>> <head runat="server">
>> <title>Server.MapPath</title>
>> </head>
>> <body>
>> <form id="form1" runat="server">
>> <div>
>> <asp:Label ID="Label1" runat="server"></asp:Label><br/>
>> </div>
>> </form>
>> </body>
>> </html>
>> ------
>>
>>
>>
>> Juan T. Llibre, asp.net MVP
>> aspnetfaq.com : http://www.aspnetfaq.com/
>> asp.net faq : http://asp.net.do/faq/
>> foros de asp.net, en espaol : http://asp.net.do/foros/
>> ===================================
>> "benoit" <benoit@.discussions.microsoft.com> wrote in message
>> news:DFDBDCA4-291C-437B-96C8-9C7DD43B7A18@.microsoft.com...
>> > Well
>>> > On ASP.NET 1.1 I had two webapps on the same server
>> > /WNW
>> > and
>> > /Data
>>> > /Data was a virtual folder in which images and Xml are stored.
>> > With Server.MapPath("/Data") i could without any problem read my Xml and
>> > images.
>> > Since I made the move to ASP.Net 2.0, I am no longer able to retrieve my
>> > data the way I used to
>>>>>> > "Peter Bromberg [C# MVP]" wrote:
>>> >> Benoit,
>> >> Server.MapPath(...) works starting at the IIS Virtual directory root of the
>> >> currently running application page.
>> >> It does not work for folders anywhere outside the IIS Vroot of the current
>> >> application.
>> >>
>> >> What is it that you are trying to accomplish?
>> >> Peter
>> >>
>> >> --
>> >> Co-founder, Eggheadcafe.com developer portal:
>> >> http://www.eggheadcafe.com
>> >> UnBlog:
>> >> http://petesbloggerama.blogspot.com
>> >>
>> >>
>> >>
>> >>
>> >> "benoit" wrote:
>> >>
>> >> > Hi,
>> >>> >> > if I write this code to retrieve a folder on the server
>> >> > Server.mappath("/DATA")
>> >>> >> > I get this error message
>> >> > System.InvalidOperationException: Failed to map the path '/DATA'
>> >>> >> > the virtual folder for my webApp is not situated in Inetpub, nor is the DATA
>> >> > folder that I would like to retrieve
>> >>> >> > anybody an idea
>> >>> >> > thx
>>
>>
>

Server.MapPath

When I access data from the root folder it is ok like
Server.MapPath ("ABC.mdb")
Please anyone tell me that how can I access the same file from the Subfolder. I have another application running in the subfolder but I want to access database on the root.
Thanks in advanceIf you server supports it you could do ../ notation. each ../ constitutes a folder level

Server.Mappath("../ABC.mdb") - 1 subfolder level
Server.Mappath("../../ABC.mdb") - 2 subfolder levels

server.mappath

i want use a private collection of fonts. i want to tell the class file using the server.mappath method the location of the fonts folder.
but the class file throws an error when i used the server method there. is there any other ways to do it.

as of now i have avoided the problem by hardcoding it[by passing the physical location as a string]

But i would like to have another solution to my problem.

Try using HttpContext.Current.Server.MapPath

Thanks


That didn't work in the business logic. i added the system.web namespace and use the statement you gave me..but still it wont work

try

using

System.IO;

string

file =Path.Combine(Request.PhysicalApplicationPath,"/fonts/arial.ttf");

string fontlocation = HttpContext.Current.Server.MapPath("./Fonts") + fontName;

i used the above code,but it didnt' work


You cannot use . in the path.

string fontlocation = HttpContext.Current.Server.MapPath("/Fonts" + fontName);

Thanks


I just copied your code and tried to run the application, it threw my System.InvalidOperationException

My fonts folders resides in the application root folder. so how am i supposed to access it from the BLL[business logic layer]


Did you keep a breakpoint and check, where the exception was raised?

The above code is how you access the server.mappath in class file. (Make sure you are writing code in C# as the above code is in C#

Thanks


try

string fontsLocation = Request.ApplicationPath + "/Fonts";

Happy Coding


as i had said in my previous post, it threw, System.InvalidOperationException.

and yes i am writing them in C#.


Keep a breakpoint and check where it is throwing the xception.

Thanks


Yes it does, it did threw the exception i mentioned above sonow i have my coding in a try catch block.

can you post your complete code?

Thanks


PrivateFontCollection FontCollection =new PrivateFontCollection();try {string fontlocation =this.fontPath+"Fonts/"+this.FamilyName +".ttf";//string fontlocation = HttpContext.Current.Server.MapPath("./Fonts") + fontName; FontCollection.AddFontFile(fontlocation); FontFamily fontFamily = FontCollection.Families[0];this.imgFont =new Font(fontFamily,this.FontSize, style, GraphicsUnit.Pixel); }catch (System.IO.FileNotFoundException ex2) {this.familyName = System.Drawing.FontFamily.GenericSerif.Name;this.imgFont =new Font(this.FamilyName,this.FontSize, style, GraphicsUnit.Pixel); }

Server.Mappath and Virtual Directories

Hello,
I have a web application with a virtual directory in it. With 'virtual
directory' i mean
a folder whose physical path is different from the physical path of the
application, but in which Web Sharing is active.
For example:
my application is in "C:\Inetpub\wwwroot\MyApp",
the Virtual folder is in "C:\VirtualFolder",
and IIS sees it as if it were in "C:\Inetpub\wwwroot\MyApp\VirtualFolder".
How can I get, from code, the real physical path of the virtual folder?
I tried with Server.Mappath, but I found that it returns
"C:\Inetpub\wwwroot\MyApp\VirtualFolder", not "C:\VirtualFolder"
Thanks
Lorenzo
LorenzoGood catch, Lorenzo.
The behavior is as you describe it, and I agree that Server.MapPath should
reflect the true physical directory of a virtual directory within an Applica
tion.
Please go to the Product Feedback Center :
http://lab.msdn.microsoft.com/produ...ck/default.aspx
and file a bug for that behavior.
You will need a Passport account to file a bug at the Feedback Center.
Thank you!
Juan T. Llibre, asp.net MVP
aspnetfaq.com : http://www.aspnetfaq.com/
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en espaol : http://asp.net.do/foros/
===================================
"Lorenzo" <Lorenzo@.discussions.microsoft.com> wrote in message
news:7A8826EF-57CC-4474-A6B1-010E00B3CD70@.microsoft.com...
> Hello,
> I have a web application with a virtual directory in it. With 'virtual
> directory' i mean
> a folder whose physical path is different from the physical path of the
> application, but in which Web Sharing is active.
> For example:
> my application is in "C:\Inetpub\wwwroot\MyApp",
> the Virtual folder is in "C:\VirtualFolder",
> and IIS sees it as if it were in "C:\Inetpub\wwwroot\MyApp\VirtualFolder".
> How can I get, from code, the real physical path of the virtual folder?
> I tried with Server.Mappath, but I found that it returns
> "C:\Inetpub\wwwroot\MyApp\VirtualFolder", not "C:\VirtualFolder"
> Thanks
> Lorenzo
> --
> Lorenzo
Thank you for the answer: I will surely report the 'Bug'.
In the meantime, could you (or someone other) suggest me another way to do
the same thing, or a workaround?
Thanks
--
Lorenzo
"Juan T. Llibre" ha scritto:

> Good catch, Lorenzo.
> The behavior is as you describe it, and I agree that Server.MapPath should
> reflect the true physical directory of a virtual directory within an Appli
cation.
> Please go to the Product Feedback Center :
> http://lab.msdn.microsoft.com/produ...ck/default.aspx
> and file a bug for that behavior.
> You will need a Passport account to file a bug at the Feedback Center.
> Thank you!
>
> Juan T. Llibre, asp.net MVP
> aspnetfaq.com : http://www.aspnetfaq.com/
> asp.net faq : http://asp.net.do/faq/
> foros de asp.net, en espa?ol : http://asp.net.do/foros/
> ===================================
> "Lorenzo" <Lorenzo@.discussions.microsoft.com> wrote in message
> news:7A8826EF-57CC-4474-A6B1-010E00B3CD70@.microsoft.com...
>
>
The bug was already reported!
(see:
http://lab.msdn.microsoft.com/produ...09-b8fb08d7cbd8
)
Reading the answer i realized that this happens only in debug mode, due to
the use, by VS2005, of Cassini; so I can fix it attaching to IIS instead of
Cassini!
Lorenzo
"Juan T. Llibre" ha scritto:

> Good catch, Lorenzo.
> The behavior is as you describe it, and I agree that Server.MapPath should
> reflect the true physical directory of a virtual directory within an Appli
cation.
> Please go to the Product Feedback Center :
> http://lab.msdn.microsoft.com/produ...ck/default.aspx
> and file a bug for that behavior.
> You will need a Passport account to file a bug at the Feedback Center.
> Thank you!
>
> Juan T. Llibre, asp.net MVP
> aspnetfaq.com : http://www.aspnetfaq.com/
> asp.net faq : http://asp.net.do/faq/
> foros de asp.net, en espa?ol : http://asp.net.do/foros/
> ===================================
> "Lorenzo" <Lorenzo@.discussions.microsoft.com> wrote in message
> news:7A8826EF-57CC-4474-A6B1-010E00B3CD70@.microsoft.com...
>
>
re:
> Thank you for the answer: I will surely report the 'Bug'.
Please do so.
That's the only way to let the Dev Team know what we know doesn't work,
so they can try to fix it...and that's the best way to get a better product.
re:
> In the meantime, could you (or someone other) suggest me another way to do
> the same thing, or a workaround?
The only workaround I can think of is not to use Server.MapPath
and, instead, hard-code the physical path.
Juan T. Llibre, asp.net MVP
aspnetfaq.com : http://www.aspnetfaq.com/
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en espaol : http://asp.net.do/foros/
===================================
"Lorenzo" <Lorenzo@.discussions.microsoft.com> wrote in message
news:6096D10D-DED4-4CFD-9075-1BB0C56C78A1@.microsoft.com...
> Thank you for the answer: I will surely report the 'Bug'.
> In the meantime, could you (or someone other) suggest me another way to do
> the same thing, or a workaround?
> Thanks
> --
> Lorenzo
>
> "Juan T. Llibre" ha scritto:
>
Yes, please bug it as happening under IIS, too.
Juan T. Llibre, asp.net MVP
aspnetfaq.com : http://www.aspnetfaq.com/
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en espaol : http://asp.net.do/foros/
===================================
"Lorenzo" <Lorenzo@.discussions.microsoft.com> wrote in message
news:984E00A5-2CCB-4A8B-8FCD-870B9DAAC94B@.microsoft.com...
> The bug was already reported!
> (see:
> http://lab.msdn.microsoft.com/produ...09-b8fb08d7cbd8
> )
> Reading the answer i realized that this happens only in debug mode, due to
> the use, by VS2005, of Cassini; so I can fix it attaching to IIS instead o
f
> Cassini!
> Lorenzo
> "Juan T. Llibre" ha scritto:
>
No, it happens only with Cassini, I just verified it!
Lorenzo
"Juan T. Llibre" ha scritto:

> Yes, please bug it as happening under IIS, too.
>
> Juan T. Llibre, asp.net MVP
> aspnetfaq.com : http://www.aspnetfaq.com/
> asp.net faq : http://asp.net.do/faq/
> foros de asp.net, en espa?ol : http://asp.net.do/foros/
> ===================================
> "Lorenzo" <Lorenzo@.discussions.microsoft.com> wrote in message
> news:984E00A5-2CCB-4A8B-8FCD-870B9DAAC94B@.microsoft.com...
>
>
>
Actually, I did quite a bit of testing with IIS after I read your post.
It happens with IIS and I can repro it.
You are mistaken about it only happening with Cassini.
File the bug or, if you are not up to it, I will.
Juan T. Llibre, asp.net MVP
aspnetfaq.com : http://www.aspnetfaq.com/
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en espaol : http://asp.net.do/foros/
===================================
"Lorenzo" <Lorenzo@.discussions.microsoft.com> wrote in message
news:7F193410-480A-412C-850D-311C53C23B0F@.microsoft.com...
> No, it happens only with Cassini, I just verified it!
> --
> Lorenzo
> "Juan T. Llibre" ha scritto:
>
Maybe I did a test sligthly different?
I Wasn't in debug mode.
In the first test, I tried opening IE and writing directly a path like this:
http:\\localhost\Projects\2006\myapp\Web
Service.asmx
(I use a WebService for the test: when invoked, it returns the path of a
virtual directory, generated via Server.Mappath).
This test works correctly!
In the second test, I tried opening IE and writing directly a path like this
:
http:\\localhost:1263\myapp\WebService.asmx
(in this way I use Cassini, it's right?).
In this test the problem happens!
I made some error?
Lorenzo
"Juan T. Llibre" ha scritto:

> Actually, I did quite a bit of testing with IIS after I read your post.
> It happens with IIS and I can repro it.
> You are mistaken about it only happening with Cassini.
> File the bug or, if you are not up to it, I will.
>
>
> Juan T. Llibre, asp.net MVP
> aspnetfaq.com : http://www.aspnetfaq.com/
> asp.net faq : http://asp.net.do/faq/
> foros de asp.net, en espa?ol : http://asp.net.do/foros/
> ===================================
> "Lorenzo" <Lorenzo@.discussions.microsoft.com> wrote in message
> news:7F193410-480A-412C-850D-311C53C23B0F@.microsoft.com...
>
>
>
You never mentioned that you were talking about a Web Service.
I tested on an aspx page, which is the *usual* type of "web application",
which is all you mentioned in your original post, so, yes, it does make for
"slightly different" testing conditions.
Post webservice.asmx so we can dissect the code in it.
It dosn't have earth-shaking super-secret code in it, does it ?
Juan T. Llibre, asp.net MVP
aspnetfaq.com : http://www.aspnetfaq.com/
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en espaol : http://asp.net.do/foros/
===================================
"Lorenzo" <Lorenzo@.discussions.microsoft.com> wrote in message
news:BB12EEBF-1CEE-46D3-978C-AC47FA0D7CE9@.microsoft.com...
> Maybe I did a test sligthly different?
> I Wasn't in debug mode.
> In the first test, I tried opening IE and writing directly a path like thi
s:
> http:\\localhost\Projects\2006\myapp\Web
Service.asmx
> (I use a WebService for the test: when invoked, it returns the path of a
> virtual directory, generated via Server.Mappath).
> This test works correctly!
> In the second test, I tried opening IE and writing directly a path like th
is:
> http:\\localhost:1263\myapp\WebService.asmx
> (in this way I use Cassini, it's right?).
> In this test the problem happens!
> I made some error?
> --
> Lorenzo
> "Juan T. Llibre" ha scritto:
>

Server.Mappath and Virtual Directories

Hello,

I have a web application with a virtual directory in it. With 'virtual
directory' i mean
a folder whose physical path is different from the physical path of the
application, but in which Web Sharing is active.
For example:
my application is in "C:\Inetpub\wwwroot\MyApp",
the Virtual folder is in "C:\VirtualFolder",
and IIS sees it as if it were in "C:\Inetpub\wwwroot\MyApp\VirtualFolder".

How can I get, from code, the real physical path of the virtual folder?
I tried with Server.Mappath, but I found that it returns
"C:\Inetpub\wwwroot\MyApp\VirtualFolder", not "C:\VirtualFolder"

Thanks
Lorenzo

--
LorenzoGood catch, Lorenzo.

The behavior is as you describe it, and I agree that Server.MapPath should
reflect the true physical directory of a virtual directory within an Application.

Please go to the Product Feedback Center :
http://lab.msdn.microsoft.com/produ...ck/default.aspx
and file a bug for that behavior.

You will need a Passport account to file a bug at the Feedback Center.

Thank you!

Juan T. Llibre, asp.net MVP
aspnetfaq.com : http://www.aspnetfaq.com/
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en espaol : http://asp.net.do/foros/
===================================
"Lorenzo" <Lorenzo@.discussions.microsoft.com> wrote in message
news:7A8826EF-57CC-4474-A6B1-010E00B3CD70@.microsoft.com...
> Hello,
> I have a web application with a virtual directory in it. With 'virtual
> directory' i mean
> a folder whose physical path is different from the physical path of the
> application, but in which Web Sharing is active.
> For example:
> my application is in "C:\Inetpub\wwwroot\MyApp",
> the Virtual folder is in "C:\VirtualFolder",
> and IIS sees it as if it were in "C:\Inetpub\wwwroot\MyApp\VirtualFolder".
> How can I get, from code, the real physical path of the virtual folder?
> I tried with Server.Mappath, but I found that it returns
> "C:\Inetpub\wwwroot\MyApp\VirtualFolder", not "C:\VirtualFolder"
> Thanks
> Lorenzo
> --
> Lorenzo
Thank you for the answer: I will surely report the 'Bug'.

In the meantime, could you (or someone other) suggest me another way to do
the same thing, or a workaround?

Thanks
--
Lorenzo

"Juan T. Llibre" ha scritto:

> Good catch, Lorenzo.
> The behavior is as you describe it, and I agree that Server.MapPath should
> reflect the true physical directory of a virtual directory within an Application.
> Please go to the Product Feedback Center :
> http://lab.msdn.microsoft.com/produ...ck/default.aspx
> and file a bug for that behavior.
> You will need a Passport account to file a bug at the Feedback Center.
> Thank you!
>
> Juan T. Llibre, asp.net MVP
> aspnetfaq.com : http://www.aspnetfaq.com/
> asp.net faq : http://asp.net.do/faq/
> foros de asp.net, en espa?ol : http://asp.net.do/foros/
> ===================================
> "Lorenzo" <Lorenzo@.discussions.microsoft.com> wrote in message
> news:7A8826EF-57CC-4474-A6B1-010E00B3CD70@.microsoft.com...
> > Hello,
> > I have a web application with a virtual directory in it. With 'virtual
> > directory' i mean
> > a folder whose physical path is different from the physical path of the
> > application, but in which Web Sharing is active.
> > For example:
> > my application is in "C:\Inetpub\wwwroot\MyApp",
> > the Virtual folder is in "C:\VirtualFolder",
> > and IIS sees it as if it were in "C:\Inetpub\wwwroot\MyApp\VirtualFolder".
> > How can I get, from code, the real physical path of the virtual folder?
> > I tried with Server.Mappath, but I found that it returns
> > "C:\Inetpub\wwwroot\MyApp\VirtualFolder", not "C:\VirtualFolder"
> > Thanks
> > Lorenzo
> > --
> > Lorenzo
>
The bug was already reported!

(see:
http://lab.msdn.microsoft.com/produ...09-b8fb08d7cbd8
)

Reading the answer i realized that this happens only in debug mode, due to
the use, by VS2005, of Cassini; so I can fix it attaching to IIS instead of
Cassini!

--
Lorenzo

"Juan T. Llibre" ha scritto:

> Good catch, Lorenzo.
> The behavior is as you describe it, and I agree that Server.MapPath should
> reflect the true physical directory of a virtual directory within an Application.
> Please go to the Product Feedback Center :
> http://lab.msdn.microsoft.com/produ...ck/default.aspx
> and file a bug for that behavior.
> You will need a Passport account to file a bug at the Feedback Center.
> Thank you!
>
> Juan T. Llibre, asp.net MVP
> aspnetfaq.com : http://www.aspnetfaq.com/
> asp.net faq : http://asp.net.do/faq/
> foros de asp.net, en espa?ol : http://asp.net.do/foros/
> ===================================
> "Lorenzo" <Lorenzo@.discussions.microsoft.com> wrote in message
> news:7A8826EF-57CC-4474-A6B1-010E00B3CD70@.microsoft.com...
> > Hello,
> > I have a web application with a virtual directory in it. With 'virtual
> > directory' i mean
> > a folder whose physical path is different from the physical path of the
> > application, but in which Web Sharing is active.
> > For example:
> > my application is in "C:\Inetpub\wwwroot\MyApp",
> > the Virtual folder is in "C:\VirtualFolder",
> > and IIS sees it as if it were in "C:\Inetpub\wwwroot\MyApp\VirtualFolder".
> > How can I get, from code, the real physical path of the virtual folder?
> > I tried with Server.Mappath, but I found that it returns
> > "C:\Inetpub\wwwroot\MyApp\VirtualFolder", not "C:\VirtualFolder"
> > Thanks
> > Lorenzo
> > --
> > Lorenzo
>
re:
> Thank you for the answer: I will surely report the 'Bug'.

Please do so.

That's the only way to let the Dev Team know what we know doesn't work,
so they can try to fix it...and that's the best way to get a better product.

re:
> In the meantime, could you (or someone other) suggest me another way to do
> the same thing, or a workaround?

The only workaround I can think of is not to use Server.MapPath
and, instead, hard-code the physical path.

Juan T. Llibre, asp.net MVP
aspnetfaq.com : http://www.aspnetfaq.com/
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en espaol : http://asp.net.do/foros/
===================================
"Lorenzo" <Lorenzo@.discussions.microsoft.com> wrote in message
news:6096D10D-DED4-4CFD-9075-1BB0C56C78A1@.microsoft.com...
> Thank you for the answer: I will surely report the 'Bug'.
> In the meantime, could you (or someone other) suggest me another way to do
> the same thing, or a workaround?
> Thanks
> --
> Lorenzo
>
> "Juan T. Llibre" ha scritto:
>> Good catch, Lorenzo.
>>
>> The behavior is as you describe it, and I agree that Server.MapPath should
>> reflect the true physical directory of a virtual directory within an Application.
>>
>> Please go to the Product Feedback Center :
>> http://lab.msdn.microsoft.com/produ...ck/default.aspx
>> and file a bug for that behavior.
>>
>> You will need a Passport account to file a bug at the Feedback Center.
>>
>> Thank you!
>>
>>
>>
>> Juan T. Llibre, asp.net MVP
>> aspnetfaq.com : http://www.aspnetfaq.com/
>> asp.net faq : http://asp.net.do/faq/
>> foros de asp.net, en espaol : http://asp.net.do/foros/
>> ===================================
>> "Lorenzo" <Lorenzo@.discussions.microsoft.com> wrote in message
>> news:7A8826EF-57CC-4474-A6B1-010E00B3CD70@.microsoft.com...
>> > Hello,
>>> > I have a web application with a virtual directory in it. With 'virtual
>> > directory' i mean
>> > a folder whose physical path is different from the physical path of the
>> > application, but in which Web Sharing is active.
>> > For example:
>> > my application is in "C:\Inetpub\wwwroot\MyApp",
>> > the Virtual folder is in "C:\VirtualFolder",
>> > and IIS sees it as if it were in "C:\Inetpub\wwwroot\MyApp\VirtualFolder".
>>> > How can I get, from code, the real physical path of the virtual folder?
>> > I tried with Server.Mappath, but I found that it returns
>> > "C:\Inetpub\wwwroot\MyApp\VirtualFolder", not "C:\VirtualFolder"
>>> > Thanks
>> > Lorenzo
>>> > --
>> > Lorenzo
>>
>>
>
Yes, please bug it as happening under IIS, too.

Juan T. Llibre, asp.net MVP
aspnetfaq.com : http://www.aspnetfaq.com/
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en espaol : http://asp.net.do/foros/
===================================
"Lorenzo" <Lorenzo@.discussions.microsoft.com> wrote in message
news:984E00A5-2CCB-4A8B-8FCD-870B9DAAC94B@.microsoft.com...
> The bug was already reported!
> (see:
> http://lab.msdn.microsoft.com/produ...09-b8fb08d7cbd8
> )
> Reading the answer i realized that this happens only in debug mode, due to
> the use, by VS2005, of Cassini; so I can fix it attaching to IIS instead of
> Cassini!
> Lorenzo

> "Juan T. Llibre" ha scritto:
>> Good catch, Lorenzo.
>>
>> The behavior is as you describe it, and I agree that Server.MapPath should
>> reflect the true physical directory of a virtual directory within an Application.
>>
>> Please go to the Product Feedback Center :
>> http://lab.msdn.microsoft.com/produ...ck/default.aspx
>> and file a bug for that behavior.
>>
>> You will need a Passport account to file a bug at the Feedback Center.
>>
>> Thank you!
>>
>>
>>
>> Juan T. Llibre, asp.net MVP
>> aspnetfaq.com : http://www.aspnetfaq.com/
>> asp.net faq : http://asp.net.do/faq/
>> foros de asp.net, en espaol : http://asp.net.do/foros/
>> ===================================
>> "Lorenzo" <Lorenzo@.discussions.microsoft.com> wrote in message
>> news:7A8826EF-57CC-4474-A6B1-010E00B3CD70@.microsoft.com...
>> > Hello,
>>> > I have a web application with a virtual directory in it. With 'virtual
>> > directory' i mean
>> > a folder whose physical path is different from the physical path of the
>> > application, but in which Web Sharing is active.
>> > For example:
>> > my application is in "C:\Inetpub\wwwroot\MyApp",
>> > the Virtual folder is in "C:\VirtualFolder",
>> > and IIS sees it as if it were in "C:\Inetpub\wwwroot\MyApp\VirtualFolder".
>>> > How can I get, from code, the real physical path of the virtual folder?
>> > I tried with Server.Mappath, but I found that it returns
>> > "C:\Inetpub\wwwroot\MyApp\VirtualFolder", not "C:\VirtualFolder"
>>> > Thanks
>> > Lorenzo
>>> > --
>> > Lorenzo
>>
>>
>
No, it happens only with Cassini, I just verified it!

--
Lorenzo

"Juan T. Llibre" ha scritto:

> Yes, please bug it as happening under IIS, too.
>
> Juan T. Llibre, asp.net MVP
> aspnetfaq.com : http://www.aspnetfaq.com/
> asp.net faq : http://asp.net.do/faq/
> foros de asp.net, en espa?ol : http://asp.net.do/foros/
> ===================================
> "Lorenzo" <Lorenzo@.discussions.microsoft.com> wrote in message
> news:984E00A5-2CCB-4A8B-8FCD-870B9DAAC94B@.microsoft.com...
> > The bug was already reported!
> > (see:
> > http://lab.msdn.microsoft.com/produ...09-b8fb08d7cbd8
> > )
> > Reading the answer i realized that this happens only in debug mode, due to
> > the use, by VS2005, of Cassini; so I can fix it attaching to IIS instead of
> > Cassini!
> > Lorenzo
>
> > "Juan T. Llibre" ha scritto:
> >> Good catch, Lorenzo.
> >>
> >> The behavior is as you describe it, and I agree that Server.MapPath should
> >> reflect the true physical directory of a virtual directory within an Application.
> >>
> >> Please go to the Product Feedback Center :
> >> http://lab.msdn.microsoft.com/produ...ck/default.aspx
> >> and file a bug for that behavior.
> >>
> >> You will need a Passport account to file a bug at the Feedback Center.
> >>
> >> Thank you!
> >>
> >>
> >>
> >> Juan T. Llibre, asp.net MVP
> >> aspnetfaq.com : http://www.aspnetfaq.com/
> >> asp.net faq : http://asp.net.do/faq/
> >> foros de asp.net, en espa?ol : http://asp.net.do/foros/
> >> ===================================
> >> "Lorenzo" <Lorenzo@.discussions.microsoft.com> wrote in message
> >> news:7A8826EF-57CC-4474-A6B1-010E00B3CD70@.microsoft.com...
> >> > Hello,
> >> >> > I have a web application with a virtual directory in it. With 'virtual
> >> > directory' i mean
> >> > a folder whose physical path is different from the physical path of the
> >> > application, but in which Web Sharing is active.
> >> > For example:
> >> > my application is in "C:\Inetpub\wwwroot\MyApp",
> >> > the Virtual folder is in "C:\VirtualFolder",
> >> > and IIS sees it as if it were in "C:\Inetpub\wwwroot\MyApp\VirtualFolder".
> >> >> > How can I get, from code, the real physical path of the virtual folder?
> >> > I tried with Server.Mappath, but I found that it returns
> >> > "C:\Inetpub\wwwroot\MyApp\VirtualFolder", not "C:\VirtualFolder"
> >> >> > Thanks
> >> > Lorenzo
> >> >> > --
> >> > Lorenzo
> >>
> >>
> >>
>
Actually, I did quite a bit of testing with IIS after I read your post.
It happens with IIS and I can repro it.

You are mistaken about it only happening with Cassini.
File the bug or, if you are not up to it, I will.

Juan T. Llibre, asp.net MVP
aspnetfaq.com : http://www.aspnetfaq.com/
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en espaol : http://asp.net.do/foros/
===================================
"Lorenzo" <Lorenzo@.discussions.microsoft.com> wrote in message
news:7F193410-480A-412C-850D-311C53C23B0F@.microsoft.com...
> No, it happens only with Cassini, I just verified it!
> --
> Lorenzo

> "Juan T. Llibre" ha scritto:
>> Yes, please bug it as happening under IIS, too.
>>
>>
>>
>> Juan T. Llibre, asp.net MVP
>> aspnetfaq.com : http://www.aspnetfaq.com/
>> asp.net faq : http://asp.net.do/faq/
>> foros de asp.net, en espaol : http://asp.net.do/foros/
>> ===================================
>> "Lorenzo" <Lorenzo@.discussions.microsoft.com> wrote in message
>> news:984E00A5-2CCB-4A8B-8FCD-870B9DAAC94B@.microsoft.com...
>> > The bug was already reported!
>>> > (see:
>> > http://lab.msdn.microsoft.com/produ...09-b8fb08d7cbd8
>> > )
>>> > Reading the answer i realized that this happens only in debug mode, due to
>> > the use, by VS2005, of Cassini; so I can fix it attaching to IIS instead of
>> > Cassini!
>> > Lorenzo
>>
>>
>> > "Juan T. Llibre" ha scritto:
>>> >> Good catch, Lorenzo.
>> >>
>> >> The behavior is as you describe it, and I agree that Server.MapPath should
>> >> reflect the true physical directory of a virtual directory within an Application.
>> >>
>> >> Please go to the Product Feedback Center :
>> >> http://lab.msdn.microsoft.com/produ...ck/default.aspx
>> >> and file a bug for that behavior.
>> >>
>> >> You will need a Passport account to file a bug at the Feedback Center.
>> >>
>> >> Thank you!
>> >>
>> >>
>> >>
>> >> Juan T. Llibre, asp.net MVP
>> >> aspnetfaq.com : http://www.aspnetfaq.com/
>> >> asp.net faq : http://asp.net.do/faq/
>> >> foros de asp.net, en espaol : http://asp.net.do/foros/
>> >> ===================================
>> >> "Lorenzo" <Lorenzo@.discussions.microsoft.com> wrote in message
>> >> news:7A8826EF-57CC-4474-A6B1-010E00B3CD70@.microsoft.com...
>> >> > Hello,
>> >>> >> > I have a web application with a virtual directory in it. With 'virtual
>> >> > directory' i mean
>> >> > a folder whose physical path is different from the physical path of the
>> >> > application, but in which Web Sharing is active.
>> >> > For example:
>> >> > my application is in "C:\Inetpub\wwwroot\MyApp",
>> >> > the Virtual folder is in "C:\VirtualFolder",
>> >> > and IIS sees it as if it were in "C:\Inetpub\wwwroot\MyApp\VirtualFolder".
>> >>> >> > How can I get, from code, the real physical path of the virtual folder?
>> >> > I tried with Server.Mappath, but I found that it returns
>> >> > "C:\Inetpub\wwwroot\MyApp\VirtualFolder", not "C:\VirtualFolder"
>> >>> >> > Thanks
>> >> > Lorenzo
>> >>> >> > --
>> >> > Lorenzo
>> >>
>> >>
>> >>
>>
>>
>
Maybe I did a test sligthly different?

I Wasn't in debug mode.

In the first test, I tried opening IE and writing directly a path like this:
http:\\localhost\Projects\2006\myapp\WebService.as mx
(I use a WebService for the test: when invoked, it returns the path of a
virtual directory, generated via Server.Mappath).
This test works correctly!

In the second test, I tried opening IE and writing directly a path like this:
http:\\localhost:1263\myapp\WebService.asmx
(in this way I use Cassini, it's right?).
In this test the problem happens!

I made some error?

--
Lorenzo

"Juan T. Llibre" ha scritto:

> Actually, I did quite a bit of testing with IIS after I read your post.
> It happens with IIS and I can repro it.
> You are mistaken about it only happening with Cassini.
> File the bug or, if you are not up to it, I will.
>
>
> Juan T. Llibre, asp.net MVP
> aspnetfaq.com : http://www.aspnetfaq.com/
> asp.net faq : http://asp.net.do/faq/
> foros de asp.net, en espa?ol : http://asp.net.do/foros/
> ===================================
> "Lorenzo" <Lorenzo@.discussions.microsoft.com> wrote in message
> news:7F193410-480A-412C-850D-311C53C23B0F@.microsoft.com...
> > No, it happens only with Cassini, I just verified it!
> > --
> > Lorenzo
>
> > "Juan T. Llibre" ha scritto:
> >> Yes, please bug it as happening under IIS, too.
> >>
> >>
> >>
> >> Juan T. Llibre, asp.net MVP
> >> aspnetfaq.com : http://www.aspnetfaq.com/
> >> asp.net faq : http://asp.net.do/faq/
> >> foros de asp.net, en espa?ol : http://asp.net.do/foros/
> >> ===================================
> >> "Lorenzo" <Lorenzo@.discussions.microsoft.com> wrote in message
> >> news:984E00A5-2CCB-4A8B-8FCD-870B9DAAC94B@.microsoft.com...
> >> > The bug was already reported!
> >> >> > (see:
> >> > http://lab.msdn.microsoft.com/produ...09-b8fb08d7cbd8
> >> > )
> >> >> > Reading the answer i realized that this happens only in debug mode, due to
> >> > the use, by VS2005, of Cassini; so I can fix it attaching to IIS instead of
> >> > Cassini!
> >> > Lorenzo
> >>
> >>
> >> > "Juan T. Llibre" ha scritto:
> >> >> >> Good catch, Lorenzo.
> >> >>
> >> >> The behavior is as you describe it, and I agree that Server.MapPath should
> >> >> reflect the true physical directory of a virtual directory within an Application.
> >> >>
> >> >> Please go to the Product Feedback Center :
> >> >> http://lab.msdn.microsoft.com/produ...ck/default.aspx
> >> >> and file a bug for that behavior.
> >> >>
> >> >> You will need a Passport account to file a bug at the Feedback Center.
> >> >>
> >> >> Thank you!
> >> >>
> >> >>
> >> >>
> >> >> Juan T. Llibre, asp.net MVP
> >> >> aspnetfaq.com : http://www.aspnetfaq.com/
> >> >> asp.net faq : http://asp.net.do/faq/
> >> >> foros de asp.net, en espa?ol : http://asp.net.do/foros/
> >> >> ===================================
> >> >> "Lorenzo" <Lorenzo@.discussions.microsoft.com> wrote in message
> >> >> news:7A8826EF-57CC-4474-A6B1-010E00B3CD70@.microsoft.com...
> >> >> > Hello,
> >> >> >> >> > I have a web application with a virtual directory in it. With 'virtual
> >> >> > directory' i mean
> >> >> > a folder whose physical path is different from the physical path of the
> >> >> > application, but in which Web Sharing is active.
> >> >> > For example:
> >> >> > my application is in "C:\Inetpub\wwwroot\MyApp",
> >> >> > the Virtual folder is in "C:\VirtualFolder",
> >> >> > and IIS sees it as if it were in "C:\Inetpub\wwwroot\MyApp\VirtualFolder".
> >> >> >> >> > How can I get, from code, the real physical path of the virtual folder?
> >> >> > I tried with Server.Mappath, but I found that it returns
> >> >> > "C:\Inetpub\wwwroot\MyApp\VirtualFolder", not "C:\VirtualFolder"
> >> >> >> >> > Thanks
> >> >> > Lorenzo
> >> >> >> >> > --
> >> >> > Lorenzo
> >> >>
> >> >>
> >> >>
> >>
> >>
> >>
>
You never mentioned that you were talking about a Web Service.

I tested on an aspx page, which is the *usual* type of "web application",
which is all you mentioned in your original post, so, yes, it does make for
"slightly different" testing conditions.

Post webservice.asmx so we can dissect the code in it.
It dosn't have earth-shaking super-secret code in it, does it ?

Juan T. Llibre, asp.net MVP
aspnetfaq.com : http://www.aspnetfaq.com/
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en espaol : http://asp.net.do/foros/
===================================
"Lorenzo" <Lorenzo@.discussions.microsoft.com> wrote in message
news:BB12EEBF-1CEE-46D3-978C-AC47FA0D7CE9@.microsoft.com...
> Maybe I did a test sligthly different?
> I Wasn't in debug mode.
> In the first test, I tried opening IE and writing directly a path like this:
> http:\\localhost\Projects\2006\myapp\WebService.as mx
> (I use a WebService for the test: when invoked, it returns the path of a
> virtual directory, generated via Server.Mappath).
> This test works correctly!
> In the second test, I tried opening IE and writing directly a path like this:
> http:\\localhost:1263\myapp\WebService.asmx
> (in this way I use Cassini, it's right?).
> In this test the problem happens!
> I made some error?
> --
> Lorenzo

> "Juan T. Llibre" ha scritto:
>> Actually, I did quite a bit of testing with IIS after I read your post.
>> It happens with IIS and I can repro it.
>>
>> You are mistaken about it only happening with Cassini.
>> File the bug or, if you are not up to it, I will.
>>
>>
>>
>>
>> Juan T. Llibre, asp.net MVP
>> aspnetfaq.com : http://www.aspnetfaq.com/
>> asp.net faq : http://asp.net.do/faq/
>> foros de asp.net, en espaol : http://asp.net.do/foros/
>> ===================================
>> "Lorenzo" <Lorenzo@.discussions.microsoft.com> wrote in message
>> news:7F193410-480A-412C-850D-311C53C23B0F@.microsoft.com...
>> > No, it happens only with Cassini, I just verified it!
>> > --
>> > Lorenzo
>>
>>
>> > "Juan T. Llibre" ha scritto:
>>> >> Yes, please bug it as happening under IIS, too.
>> >>
>> >>
>> >>
>> >> Juan T. Llibre, asp.net MVP
>> >> aspnetfaq.com : http://www.aspnetfaq.com/
>> >> asp.net faq : http://asp.net.do/faq/
>> >> foros de asp.net, en espaol : http://asp.net.do/foros/
>> >> ===================================
>> >> "Lorenzo" <Lorenzo@.discussions.microsoft.com> wrote in message
>> >> news:984E00A5-2CCB-4A8B-8FCD-870B9DAAC94B@.microsoft.com...
>> >> > The bug was already reported!
>> >>> >> > (see:
>> >> > http://lab.msdn.microsoft.com/produ...09-b8fb08d7cbd8
>> >> > )
>> >>> >> > Reading the answer i realized that this happens only in debug mode, due to
>> >> > the use, by VS2005, of Cassini; so I can fix it attaching to IIS instead of
>> >> > Cassini!
>> >> > Lorenzo
>> >>
>> >>
>> >> > "Juan T. Llibre" ha scritto:
>> >>> >> >> Good catch, Lorenzo.
>> >> >>
>> >> >> The behavior is as you describe it, and I agree that Server.MapPath should
>> >> >> reflect the true physical directory of a virtual directory within an Application.
>> >> >>
>> >> >> Please go to the Product Feedback Center :
>> >> >> http://lab.msdn.microsoft.com/produ...ck/default.aspx
>> >> >> and file a bug for that behavior.
>> >> >>
>> >> >> You will need a Passport account to file a bug at the Feedback Center.
>> >> >>
>> >> >> Thank you!
>> >> >>
>> >> >>
>> >> >>
>> >> >> Juan T. Llibre, asp.net MVP
>> >> >> aspnetfaq.com : http://www.aspnetfaq.com/
>> >> >> asp.net faq : http://asp.net.do/faq/
>> >> >> foros de asp.net, en espaol : http://asp.net.do/foros/
>> >> >> ===================================
>> >> >> "Lorenzo" <Lorenzo@.discussions.microsoft.com> wrote in message
>> >> >> news:7A8826EF-57CC-4474-A6B1-010E00B3CD70@.microsoft.com...
>> >> >> > Hello,
>> >> >>> >> >> > I have a web application with a virtual directory in it. With 'virtual
>> >> >> > directory' i mean
>> >> >> > a folder whose physical path is different from the physical path of the
>> >> >> > application, but in which Web Sharing is active.
>> >> >> > For example:
>> >> >> > my application is in "C:\Inetpub\wwwroot\MyApp",
>> >> >> > the Virtual folder is in "C:\VirtualFolder",
>> >> >> > and IIS sees it as if it were in "C:\Inetpub\wwwroot\MyApp\VirtualFolder".
>> >> >>> >> >> > How can I get, from code, the real physical path of the virtual folder?
>> >> >> > I tried with Server.Mappath, but I found that it returns
>> >> >> > "C:\Inetpub\wwwroot\MyApp\VirtualFolder", not "C:\VirtualFolder"
>> >> >>> >> >> > Thanks
>> >> >> > Lorenzo
>> >> >>> >> >> > --
>> >> >> > Lorenzo
>> >> >>
>> >> >>
>> >> >>
>> >>
>> >>
>> >>
>>
>>
>
Today I'm out of office, but tomorrow, I will try with a web page (I thought
it was the same thing than a webservice), and I'll post to you my code.

See you tomorrow!

--
Lorenzo

"Juan T. Llibre" ha scritto:

> You never mentioned that you were talking about a Web Service.
> I tested on an aspx page, which is the *usual* type of "web application",
> which is all you mentioned in your original post, so, yes, it does make for
> "slightly different" testing conditions.
> Post webservice.asmx so we can dissect the code in it.
> It dosn't have earth-shaking super-secret code in it, does it ?
>
>
> Juan T. Llibre, asp.net MVP
> aspnetfaq.com : http://www.aspnetfaq.com/
> asp.net faq : http://asp.net.do/faq/
> foros de asp.net, en espa?ol : http://asp.net.do/foros/
> ===================================
> "Lorenzo" <Lorenzo@.discussions.microsoft.com> wrote in message
> news:BB12EEBF-1CEE-46D3-978C-AC47FA0D7CE9@.microsoft.com...
> > Maybe I did a test sligthly different?
> > I Wasn't in debug mode.
> > In the first test, I tried opening IE and writing directly a path like this:
> > http:\\localhost\Projects\2006\myapp\WebService.as mx
> > (I use a WebService for the test: when invoked, it returns the path of a
> > virtual directory, generated via Server.Mappath).
> > This test works correctly!
> > In the second test, I tried opening IE and writing directly a path like this:
> > http:\\localhost:1263\myapp\WebService.asmx
> > (in this way I use Cassini, it's right?).
> > In this test the problem happens!
> > I made some error?
> > --
> > Lorenzo
>
> > "Juan T. Llibre" ha scritto:
> >> Actually, I did quite a bit of testing with IIS after I read your post.
> >> It happens with IIS and I can repro it.
> >>
> >> You are mistaken about it only happening with Cassini.
> >> File the bug or, if you are not up to it, I will.
> >>
> >>
> >>
> >>
> >> Juan T. Llibre, asp.net MVP
> >> aspnetfaq.com : http://www.aspnetfaq.com/
> >> asp.net faq : http://asp.net.do/faq/
> >> foros de asp.net, en espa?ol : http://asp.net.do/foros/
> >> ===================================
> >> "Lorenzo" <Lorenzo@.discussions.microsoft.com> wrote in message
> >> news:7F193410-480A-412C-850D-311C53C23B0F@.microsoft.com...
> >> > No, it happens only with Cassini, I just verified it!
> >> > --
> >> > Lorenzo
> >>
> >>
> >> > "Juan T. Llibre" ha scritto:
> >> >> >> Yes, please bug it as happening under IIS, too.
> >> >>
> >> >>
> >> >>
> >> >> Juan T. Llibre, asp.net MVP
> >> >> aspnetfaq.com : http://www.aspnetfaq.com/
> >> >> asp.net faq : http://asp.net.do/faq/
> >> >> foros de asp.net, en espa?ol : http://asp.net.do/foros/
> >> >> ===================================
> >> >> "Lorenzo" <Lorenzo@.discussions.microsoft.com> wrote in message
> >> >> news:984E00A5-2CCB-4A8B-8FCD-870B9DAAC94B@.microsoft.com...
> >> >> > The bug was already reported!
> >> >> >> >> > (see:
> >> >> > http://lab.msdn.microsoft.com/produ...09-b8fb08d7cbd8
> >> >> > )
> >> >> >> >> > Reading the answer i realized that this happens only in debug mode, due to
> >> >> > the use, by VS2005, of Cassini; so I can fix it attaching to IIS instead of
> >> >> > Cassini!
> >> >> > Lorenzo
> >> >>
> >> >>
> >> >> > "Juan T. Llibre" ha scritto:
> >> >> >> >> >> Good catch, Lorenzo.
> >> >> >>
> >> >> >> The behavior is as you describe it, and I agree that Server.MapPath should
> >> >> >> reflect the true physical directory of a virtual directory within an Application.
> >> >> >>
> >> >> >> Please go to the Product Feedback Center :
> >> >> >> http://lab.msdn.microsoft.com/produ...ck/default.aspx
> >> >> >> and file a bug for that behavior.
> >> >> >>
> >> >> >> You will need a Passport account to file a bug at the Feedback Center.
> >> >> >>
> >> >> >> Thank you!
> >> >> >>
> >> >> >>
> >> >> >>
> >> >> >> Juan T. Llibre, asp.net MVP
> >> >> >> aspnetfaq.com : http://www.aspnetfaq.com/
> >> >> >> asp.net faq : http://asp.net.do/faq/
> >> >> >> foros de asp.net, en espa?ol : http://asp.net.do/foros/
> >> >> >> ===================================
> >> >> >> "Lorenzo" <Lorenzo@.discussions.microsoft.com> wrote in message
> >> >> >> news:7A8826EF-57CC-4474-A6B1-010E00B3CD70@.microsoft.com...
> >> >> >> > Hello,
> >> >> >> >> >> >> > I have a web application with a virtual directory in it. With 'virtual
> >> >> >> > directory' i mean
> >> >> >> > a folder whose physical path is different from the physical path of the
> >> >> >> > application, but in which Web Sharing is active.
> >> >> >> > For example:
> >> >> >> > my application is in "C:\Inetpub\wwwroot\MyApp",
> >> >> >> > the Virtual folder is in "C:\VirtualFolder",
> >> >> >> > and IIS sees it as if it were in "C:\Inetpub\wwwroot\MyApp\VirtualFolder".
> >> >> >> >> >> >> > How can I get, from code, the real physical path of the virtual folder?
> >> >> >> > I tried with Server.Mappath, but I found that it returns
> >> >> >> > "C:\Inetpub\wwwroot\MyApp\VirtualFolder", not "C:\VirtualFolder"
> >> >> >> >> >> >> > Thanks
> >> >> >> > Lorenzo
> >> >> >> >> >> >> > --
> >> >> >> > Lorenzo
> >> >> >>
> >> >> >>
> >> >> >>
> >> >>
> >> >>
> >> >>
> >>
> >>
> >>
>
I tested the same thing with a webpage:
the problem was identical, as I supposed.

The code to reproduce the test is quite simple:

Protected Sub Page_Load(ByVal sender As Object, ByVal e As
System.EventArgs)Handles Me.Load
Label2.Text = Server.MapPath("Prova")
End Sub

(where Label2 is a Label Webcontrol and "Prova" is the virtual directory)

The result is correct if, in IE, I reach the page using this address:
http:\\localhost\Projects\2006\myapp\default2.aspx
(so using IIS)

The result is wrong if, in IE, I reach the page using this address:
http:\\localhost:1263\myapp\default2.aspx
(so using Cassini)

With the webservice, the code was:

<WebMethod()> _
Public Function AbsoluteEventsPath() As String
Return Server.MapPath("Prova")
End Function

In my opinion, this is exactly the situation described in the filed bug, and
it's due to a 'limitation' of Cassini that does not behave like IIS.
(Luckily, this is not a big deal for me, because in the production server I
use IIS).

If you went deeper than me and found a different situation, file it by
yourself, and please notify it to me, that I am very curoius!

(my e-mail is lorenzoaaa@.REMOVE_MEtiscali.it)

Bye
Lorenzo

--
Lorenzo

"Juan T. Llibre" ha scritto:

> You never mentioned that you were talking about a Web Service.
> I tested on an aspx page, which is the *usual* type of "web application",
> which is all you mentioned in your original post, so, yes, it does make for
> "slightly different" testing conditions.
> Post webservice.asmx so we can dissect the code in it.
> It dosn't have earth-shaking super-secret code in it, does it ?
>
>
> Juan T. Llibre, asp.net MVP
> aspnetfaq.com : http://www.aspnetfaq.com/
> asp.net faq : http://asp.net.do/faq/
> foros de asp.net, en espa?ol : http://asp.net.do/foros/
> ===================================
> "Lorenzo" <Lorenzo@.discussions.microsoft.com> wrote in message
> news:BB12EEBF-1CEE-46D3-978C-AC47FA0D7CE9@.microsoft.com...
> > Maybe I did a test sligthly different?
> > I Wasn't in debug mode.
> > In the first test, I tried opening IE and writing directly a path like this:
> > http:\\localhost\Projects\2006\myapp\WebService.as mx
> > (I use a WebService for the test: when invoked, it returns the path of a
> > virtual directory, generated via Server.Mappath).
> > This test works correctly!
> > In the second test, I tried opening IE and writing directly a path like this:
> > http:\\localhost:1263\myapp\WebService.asmx
> > (in this way I use Cassini, it's right?).
> > In this test the problem happens!
> > I made some error?
> > --
> > Lorenzo
>
> > "Juan T. Llibre" ha scritto:
> >> Actually, I did quite a bit of testing with IIS after I read your post.
> >> It happens with IIS and I can repro it.
> >>
> >> You are mistaken about it only happening with Cassini.
> >> File the bug or, if you are not up to it, I will.
> >>
> >>
> >>
> >>
> >> Juan T. Llibre, asp.net MVP
> >> aspnetfaq.com : http://www.aspnetfaq.com/
> >> asp.net faq : http://asp.net.do/faq/
> >> foros de asp.net, en espa?ol : http://asp.net.do/foros/
> >> ===================================
> >> "Lorenzo" <Lorenzo@.discussions.microsoft.com> wrote in message
> >> news:7F193410-480A-412C-850D-311C53C23B0F@.microsoft.com...
> >> > No, it happens only with Cassini, I just verified it!
> >> > --
> >> > Lorenzo
> >>
> >>
> >> > "Juan T. Llibre" ha scritto:
> >> >> >> Yes, please bug it as happening under IIS, too.
> >> >>
> >> >>
> >> >>
> >> >> Juan T. Llibre, asp.net MVP
> >> >> aspnetfaq.com : http://www.aspnetfaq.com/
> >> >> asp.net faq : http://asp.net.do/faq/
> >> >> foros de asp.net, en espa?ol : http://asp.net.do/foros/
> >> >> ===================================
> >> >> "Lorenzo" <Lorenzo@.discussions.microsoft.com> wrote in message
> >> >> news:984E00A5-2CCB-4A8B-8FCD-870B9DAAC94B@.microsoft.com...
> >> >> > The bug was already reported!
> >> >> >> >> > (see:
> >> >> > http://lab.msdn.microsoft.com/produ...09-b8fb08d7cbd8
> >> >> > )
> >> >> >> >> > Reading the answer i realized that this happens only in debug mode, due to
> >> >> > the use, by VS2005, of Cassini; so I can fix it attaching to IIS instead of
> >> >> > Cassini!
> >> >> > Lorenzo
> >> >>
> >> >>
> >> >> > "Juan T. Llibre" ha scritto:
> >> >> >> >> >> Good catch, Lorenzo.
> >> >> >>
> >> >> >> The behavior is as you describe it, and I agree that Server.MapPath should
> >> >> >> reflect the true physical directory of a virtual directory within an Application.
> >> >> >>
> >> >> >> Please go to the Product Feedback Center :
> >> >> >> http://lab.msdn.microsoft.com/produ...ck/default.aspx
> >> >> >> and file a bug for that behavior.
> >> >> >>
> >> >> >> You will need a Passport account to file a bug at the Feedback Center.
> >> >> >>
> >> >> >> Thank you!
> >> >> >>
> >> >> >>
> >> >> >>
> >> >> >> Juan T. Llibre, asp.net MVP
> >> >> >> aspnetfaq.com : http://www.aspnetfaq.com/
> >> >> >> asp.net faq : http://asp.net.do/faq/
> >> >> >> foros de asp.net, en espa?ol : http://asp.net.do/foros/
> >> >> >> ===================================
> >> >> >> "Lorenzo" <Lorenzo@.discussions.microsoft.com> wrote in message
> >> >> >> news:7A8826EF-57CC-4474-A6B1-010E00B3CD70@.microsoft.com...
> >> >> >> > Hello,
> >> >> >> >> >> >> > I have a web application with a virtual directory in it. With 'virtual
> >> >> >> > directory' i mean
> >> >> >> > a folder whose physical path is different from the physical path of the
> >> >> >> > application, but in which Web Sharing is active.
> >> >> >> > For example:
> >> >> >> > my application is in "C:\Inetpub\wwwroot\MyApp",
> >> >> >> > the Virtual folder is in "C:\VirtualFolder",
> >> >> >> > and IIS sees it as if it were in "C:\Inetpub\wwwroot\MyApp\VirtualFolder".
> >> >> >> >> >> >> > How can I get, from code, the real physical path of the virtual folder?
> >> >> >> > I tried with Server.Mappath, but I found that it returns
> >> >> >> > "C:\Inetpub\wwwroot\MyApp\VirtualFolder", not "C:\VirtualFolder"
> >> >> >> >> >> >> > Thanks
> >> >> >> > Lorenzo
> >> >> >> >> >> >> > --
> >> >> >> > Lorenzo
> >> >> >>
> >> >> >>
> >> >> >>
> >> >>
> >> >>
> >> >>
> >>
> >>
> >>
>
Try, if "Prova" is a virtual directory/application :

Server.MapPath("/Prova")

Notice the slash...

Juan T. Llibre, asp.net MVP
aspnetfaq.com : http://www.aspnetfaq.com/
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en espaol : http://asp.net.do/foros/
===================================
"Lorenzo" <Lorenzo@.discussions.microsoft.com> wrote in message
news:A68BE1E2-6252-443E-BBEE-E7A328542458@.microsoft.com...
>I tested the same thing with a webpage:
> the problem was identical, as I supposed.
> The code to reproduce the test is quite simple:
> Protected Sub Page_Load(ByVal sender As Object, ByVal e As
> System.EventArgs)Handles Me.Load
> Label2.Text = Server.MapPath("Prova")
> End Sub
> (where Label2 is a Label Webcontrol and "Prova" is the virtual directory)
>
> The result is correct if, in IE, I reach the page using this address:
> http:\\localhost\Projects\2006\myapp\default2.aspx
> (so using IIS)
> The result is wrong if, in IE, I reach the page using this address:
> http:\\localhost:1263\myapp\default2.aspx
> (so using Cassini)
> With the webservice, the code was:
> <WebMethod()> _
> Public Function AbsoluteEventsPath() As String
> Return Server.MapPath("Prova")
> End Function
>
> In my opinion, this is exactly the situation described in the filed bug, and
> it's due to a 'limitation' of Cassini that does not behave like IIS.
> (Luckily, this is not a big deal for me, because in the production server I
> use IIS).
> If you went deeper than me and found a different situation, file it by
> yourself, and please notify it to me, that I am very curoius!
> (my e-mail is lorenzoaaa@.REMOVE_MEtiscali.it)
> Bye
> Lorenzo
> --
> Lorenzo
>
> "Juan T. Llibre" ha scritto:
>> You never mentioned that you were talking about a Web Service.
>>
>> I tested on an aspx page, which is the *usual* type of "web application",
>> which is all you mentioned in your original post, so, yes, it does make for
>> "slightly different" testing conditions.
>>
>> Post webservice.asmx so we can dissect the code in it.
>> It dosn't have earth-shaking super-secret code in it, does it ?
>>
>>
>>
>>
>> Juan T. Llibre, asp.net MVP
>> aspnetfaq.com : http://www.aspnetfaq.com/
>> asp.net faq : http://asp.net.do/faq/
>> foros de asp.net, en espaol : http://asp.net.do/foros/
>> ===================================
>> "Lorenzo" <Lorenzo@.discussions.microsoft.com> wrote in message
>> news:BB12EEBF-1CEE-46D3-978C-AC47FA0D7CE9@.microsoft.com...
>> > Maybe I did a test sligthly different?
>>> > I Wasn't in debug mode.
>>> > In the first test, I tried opening IE and writing directly a path like this:
>> > http:\\localhost\Projects\2006\myapp\WebService.as mx
>> > (I use a WebService for the test: when invoked, it returns the path of a
>> > virtual directory, generated via Server.Mappath).
>> > This test works correctly!
>>> > In the second test, I tried opening IE and writing directly a path like this:
>> > http:\\localhost:1263\myapp\WebService.asmx
>> > (in this way I use Cassini, it's right?).
>> > In this test the problem happens!
>>> > I made some error?
>> > --
>> > Lorenzo
>>
>>
>> > "Juan T. Llibre" ha scritto:
>>> >> Actually, I did quite a bit of testing with IIS after I read your post.
>> >> It happens with IIS and I can repro it.
>> >>
>> >> You are mistaken about it only happening with Cassini.
>> >> File the bug or, if you are not up to it, I will.
>> >>
>> >>
>> >>
>> >>
>> >> Juan T. Llibre, asp.net MVP
>> >> aspnetfaq.com : http://www.aspnetfaq.com/
>> >> asp.net faq : http://asp.net.do/faq/
>> >> foros de asp.net, en espaol : http://asp.net.do/foros/
>> >> ===================================
>> >> "Lorenzo" <Lorenzo@.discussions.microsoft.com> wrote in message
>> >> news:7F193410-480A-412C-850D-311C53C23B0F@.microsoft.com...
>> >> > No, it happens only with Cassini, I just verified it!
>> >> > --
>> >> > Lorenzo
>> >>
>> >>
>> >> > "Juan T. Llibre" ha scritto:
>> >>> >> >> Yes, please bug it as happening under IIS, too.
>> >> >>
>> >> >>
>> >> >>
>> >> >> Juan T. Llibre, asp.net MVP
>> >> >> aspnetfaq.com : http://www.aspnetfaq.com/
>> >> >> asp.net faq : http://asp.net.do/faq/
>> >> >> foros de asp.net, en espaol : http://asp.net.do/foros/
>> >> >> ===================================
>> >> >> "Lorenzo" <Lorenzo@.discussions.microsoft.com> wrote in message
>> >> >> news:984E00A5-2CCB-4A8B-8FCD-870B9DAAC94B@.microsoft.com...
>> >> >> > The bug was already reported!
>> >> >>> >> >> > (see:
>> >> >> > http://lab.msdn.microsoft.com/produ...09-b8fb08d7cbd8
>> >> >> > )
>> >> >>> >> >> > Reading the answer i realized that this happens only in debug mode, due to
>> >> >> > the use, by VS2005, of Cassini; so I can fix it attaching to IIS instead of
>> >> >> > Cassini!
>> >> >> > Lorenzo
>> >> >>
>> >> >>
>> >> >> > "Juan T. Llibre" ha scritto:
>> >> >>> >> >> >> Good catch, Lorenzo.
>> >> >> >>
>> >> >> >> The behavior is as you describe it, and I agree that Server.MapPath should
>> >> >> >> reflect the true physical directory of a virtual directory within an Application.
>> >> >> >>
>> >> >> >> Please go to the Product Feedback Center :
>> >> >> >> http://lab.msdn.microsoft.com/produ...ck/default.aspx
>> >> >> >> and file a bug for that behavior.
>> >> >> >>
>> >> >> >> You will need a Passport account to file a bug at the Feedback Center.
>> >> >> >>
>> >> >> >> Thank you!
>> >> >> >>
>> >> >> >>
>> >> >> >>
>> >> >> >> Juan T. Llibre, asp.net MVP
>> >> >> >> aspnetfaq.com : http://www.aspnetfaq.com/
>> >> >> >> asp.net faq : http://asp.net.do/faq/
>> >> >> >> foros de asp.net, en espaol : http://asp.net.do/foros/
>> >> >> >> ===================================
>> >> >> >> "Lorenzo" <Lorenzo@.discussions.microsoft.com> wrote in message
>> >> >> >> news:7A8826EF-57CC-4474-A6B1-010E00B3CD70@.microsoft.com...
>> >> >> >> > Hello,
>> >> >> >>> >> >> >> > I have a web application with a virtual directory in it. With 'virtual
>> >> >> >> > directory' i mean
>> >> >> >> > a folder whose physical path is different from the physical path of the
>> >> >> >> > application, but in which Web Sharing is active.
>> >> >> >> > For example:
>> >> >> >> > my application is in "C:\Inetpub\wwwroot\MyApp",
>> >> >> >> > the Virtual folder is in "C:\VirtualFolder",
>> >> >> >> > and IIS sees it as if it were in "C:\Inetpub\wwwroot\MyApp\VirtualFolder".
>> >> >> >>> >> >> >> > How can I get, from code, the real physical path of the virtual folder?
>> >> >> >> > I tried with Server.Mappath, but I found that it returns
>> >> >> >> > "C:\Inetpub\wwwroot\MyApp\VirtualFolder", not "C:\VirtualFolder"
>> >> >> >>> >> >> >> > Thanks
>> >> >> >> > Lorenzo
>> >> >> >>> >> >> >> > --
>> >> >> >> > Lorenzo
>> >> >> >>
>> >> >> >>
>> >> >> >>
>> >> >>
>> >> >>
>> >> >>
>> >>
>> >>
>> >>
>>
>>
>
This isn't a correct test to try: if I write "/Prova", it searches a folder
directly in my localhost root, not in the current web application!
You can try by yourself. Notice the different behavior of Cassini and IIS:
IIS returns
"C:\Inetpub\wwwroot\Prova", Cassini raises an error!

By
--
Lorenzo

"Juan T. Llibre" ha scritto:

> Try, if "Prova" is a virtual directory/application :
> Server.MapPath("/Prova")
> Notice the slash...
>
> Juan T. Llibre, asp.net MVP
> aspnetfaq.com : http://www.aspnetfaq.com/
> asp.net faq : http://asp.net.do/faq/
> foros de asp.net, en espa?ol : http://asp.net.do/foros/
> ===================================
> "Lorenzo" <Lorenzo@.discussions.microsoft.com> wrote in message
> news:A68BE1E2-6252-443E-BBEE-E7A328542458@.microsoft.com...
> >I tested the same thing with a webpage:
> > the problem was identical, as I supposed.
> > The code to reproduce the test is quite simple:
> > Protected Sub Page_Load(ByVal sender As Object, ByVal e As
> > System.EventArgs)Handles Me.Load
> > Label2.Text = Server.MapPath("Prova")
> > End Sub
> > (where Label2 is a Label Webcontrol and "Prova" is the virtual directory)
> > The result is correct if, in IE, I reach the page using this address:
> > http:\\localhost\Projects\2006\myapp\default2.aspx
> > (so using IIS)
> > The result is wrong if, in IE, I reach the page using this address:
> > http:\\localhost:1263\myapp\default2.aspx
> > (so using Cassini)
> > With the webservice, the code was:
> > <WebMethod()> _
> > Public Function AbsoluteEventsPath() As String
> > Return Server.MapPath("Prova")
> > End Function
> > In my opinion, this is exactly the situation described in the filed bug, and
> > it's due to a 'limitation' of Cassini that does not behave like IIS.
> > (Luckily, this is not a big deal for me, because in the production server I
> > use IIS).
> > If you went deeper than me and found a different situation, file it by
> > yourself, and please notify it to me, that I am very curoius!
> > (my e-mail is lorenzoaaa@.REMOVE_MEtiscali.it)
> > Bye
> > Lorenzo
> > --
> > Lorenzo
> > "Juan T. Llibre" ha scritto:
> >> You never mentioned that you were talking about a Web Service.
> >>
> >> I tested on an aspx page, which is the *usual* type of "web application",
> >> which is all you mentioned in your original post, so, yes, it does make for
> >> "slightly different" testing conditions.
> >>
> >> Post webservice.asmx so we can dissect the code in it.
> >> It dosn't have earth-shaking super-secret code in it, does it ?
> >>
> >>
> >>
> >>
> >> Juan T. Llibre, asp.net MVP
> >> aspnetfaq.com : http://www.aspnetfaq.com/
> >> asp.net faq : http://asp.net.do/faq/
> >> foros de asp.net, en espa?ol : http://asp.net.do/foros/
> >> ===================================
> >> "Lorenzo" <Lorenzo@.discussions.microsoft.com> wrote in message
> >> news:BB12EEBF-1CEE-46D3-978C-AC47FA0D7CE9@.microsoft.com...
> >> > Maybe I did a test sligthly different?
> >> >> > I Wasn't in debug mode.
> >> >> > In the first test, I tried opening IE and writing directly a path like this:
> >> > http:\\localhost\Projects\2006\myapp\WebService.as mx
> >> > (I use a WebService for the test: when invoked, it returns the path of a
> >> > virtual directory, generated via Server.Mappath).
> >> > This test works correctly!
> >> >> > In the second test, I tried opening IE and writing directly a path like this:
> >> > http:\\localhost:1263\myapp\WebService.asmx
> >> > (in this way I use Cassini, it's right?).
> >> > In this test the problem happens!
> >> >> > I made some error?
> >> > --
> >> > Lorenzo
> >>
> >>
> >> > "Juan T. Llibre" ha scritto:
> >> >> >> Actually, I did quite a bit of testing with IIS after I read your post.
> >> >> It happens with IIS and I can repro it.
> >> >>
> >> >> You are mistaken about it only happening with Cassini.
> >> >> File the bug or, if you are not up to it, I will.
> >> >>
> >> >>
> >> >>
> >> >>
> >> >> Juan T. Llibre, asp.net MVP
> >> >> aspnetfaq.com : http://www.aspnetfaq.com/
> >> >> asp.net faq : http://asp.net.do/faq/
> >> >> foros de asp.net, en espa?ol : http://asp.net.do/foros/
> >> >> ===================================
> >> >> "Lorenzo" <Lorenzo@.discussions.microsoft.com> wrote in message
> >> >> news:7F193410-480A-412C-850D-311C53C23B0F@.microsoft.com...
> >> >> > No, it happens only with Cassini, I just verified it!
> >> >> > --
> >> >> > Lorenzo
> >> >>
> >> >>
> >> >> > "Juan T. Llibre" ha scritto:
> >> >> >> >> >> Yes, please bug it as happening under IIS, too.
> >> >> >>
> >> >> >>
> >> >> >>
> >> >> >> Juan T. Llibre, asp.net MVP
> >> >> >> aspnetfaq.com : http://www.aspnetfaq.com/
> >> >> >> asp.net faq : http://asp.net.do/faq/
> >> >> >> foros de asp.net, en espa?ol : http://asp.net.do/foros/
> >> >> >> ===================================
> >> >> >> "Lorenzo" <Lorenzo@.discussions.microsoft.com> wrote in message
> >> >> >> news:984E00A5-2CCB-4A8B-8FCD-870B9DAAC94B@.microsoft.com...
> >> >> >> > The bug was already reported!
> >> >> >> >> >> >> > (see:
> >> >> >> > http://lab.msdn.microsoft.com/produ...09-b8fb08d7cbd8
> >> >> >> > )
> >> >> >> >> >> >> > Reading the answer i realized that this happens only in debug mode, due to
> >> >> >> > the use, by VS2005, of Cassini; so I can fix it attaching to IIS instead of
> >> >> >> > Cassini!
> >> >> >> > Lorenzo
> >> >> >>
> >> >> >>
> >> >> >> > "Juan T. Llibre" ha scritto:
> >> >> >> >> >> >> >> Good catch, Lorenzo.
> >> >> >> >>
> >> >> >> >> The behavior is as you describe it, and I agree that Server.MapPath should
> >> >> >> >> reflect the true physical directory of a virtual directory within an Application.
> >> >> >> >>
> >> >> >> >> Please go to the Product Feedback Center :
> >> >> >> >> http://lab.msdn.microsoft.com/produ...ck/default.aspx
> >> >> >> >> and file a bug for that behavior.
> >> >> >> >>
> >> >> >> >> You will need a Passport account to file a bug at the Feedback Center.
> >> >> >> >>
> >> >> >> >> Thank you!
> >> >> >> >>
> >> >> >> >>
> >> >> >> >>
> >> >> >> >> Juan T. Llibre, asp.net MVP
> >> >> >> >> aspnetfaq.com : http://www.aspnetfaq.com/
> >> >> >> >> asp.net faq : http://asp.net.do/faq/
> >> >> >> >> foros de asp.net, en espa?ol : http://asp.net.do/foros/
> >> >> >> >> ===================================
> >> >> >> >> "Lorenzo" <Lorenzo@.discussions.microsoft.com> wrote in message
> >> >> >> >> news:7A8826EF-57CC-4474-A6B1-010E00B3CD70@.microsoft.com...
> >> >> >> >> > Hello,
> >> >> >> >> >> >> >> >> > I have a web application with a virtual directory in it. With 'virtual
> >> >> >> >> > directory' i mean
> >> >> >> >> > a folder whose physical path is different from the physical path of the
> >> >> >> >> > application, but in which Web Sharing is active.
> >> >> >> >> > For example:
> >> >> >> >> > my application is in "C:\Inetpub\wwwroot\MyApp",
> >> >> >> >> > the Virtual folder is in "C:\VirtualFolder",
> >> >> >> >> > and IIS sees it as if it were in "C:\Inetpub\wwwroot\MyApp\VirtualFolder".
> >> >> >> >> >> >> >> >> > How can I get, from code, the real physical path of the virtual folder?
> >> >> >> >> > I tried with Server.Mappath, but I found that it returns
> >> >> >> >> > "C:\Inetpub\wwwroot\MyApp\VirtualFolder", not "C:\VirtualFolder"
> >> >> >> >> >> >> >> >> > Thanks
> >> >> >> >> > Lorenzo
> >> >> >> >> >> >> >> >> > --
> >> >> >> >> > Lorenzo
> >> >> >> >>
> >> >> >> >>
> >> >> >> >>
> >> >> >>
> >> >> >>
> >> >> >>
> >> >>
> >> >>
> >> >>
> >>
> >>
> >>
>
> .
That's why it's a bug!

Please file a bug report at :

http://lab.msdn.microsoft.com/produ...ck/default.aspx

Make sure that you point out the differences with the similar bug reported already :

http://lab.msdn.microsoft.com/produ...09-b8fb08d7cbd8

Juan T. Llibre, asp.net MVP
aspnetfaq.com : http://www.aspnetfaq.com/
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en espaol : http://asp.net.do/foros/
===================================
"Lorenzo" <Lorenzo@.discussions.microsoft.com> wrote in message
news:D1347A6F-60A9-4954-81E3-2AD27D4DBF49@.microsoft.com...
> This isn't a correct test to try: if I write "/Prova", it searches a folder
> directly in my localhost root, not in the current web application!
> You can try by yourself. Notice the different behavior of Cassini and IIS:
> IIS returns
> "C:\Inetpub\wwwroot\Prova", Cassini raises an error!
> By
> --
> Lorenzo
>
> "Juan T. Llibre" ha scritto:
>> Try, if "Prova" is a virtual directory/application :
>>
>> Server.MapPath("/Prova")
>>
>> Notice the slash...
>>
>>
>>
>> Juan T. Llibre, asp.net MVP
>> aspnetfaq.com : http://www.aspnetfaq.com/
>> asp.net faq : http://asp.net.do/faq/
>> foros de asp.net, en espaol : http://asp.net.do/foros/
>> ===================================
>> "Lorenzo" <Lorenzo@.discussions.microsoft.com> wrote in message
>> news:A68BE1E2-6252-443E-BBEE-E7A328542458@.microsoft.com...
>> >I tested the same thing with a webpage:
>> > the problem was identical, as I supposed.
>>> > The code to reproduce the test is quite simple:
>>> > Protected Sub Page_Load(ByVal sender As Object, ByVal e As
>> > System.EventArgs)Handles Me.Load
>> > Label2.Text = Server.MapPath("Prova")
>> > End Sub
>>> > (where Label2 is a Label Webcontrol and "Prova" is the virtual directory)
>>>> > The result is correct if, in IE, I reach the page using this address:
>> > http:\\localhost\Projects\2006\myapp\default2.aspx
>> > (so using IIS)
>>> > The result is wrong if, in IE, I reach the page using this address:
>> > http:\\localhost:1263\myapp\default2.aspx
>> > (so using Cassini)
>>> > With the webservice, the code was:
>>> > <WebMethod()> _
>> > Public Function AbsoluteEventsPath() As String
>> > Return Server.MapPath("Prova")
>> > End Function
>>>> > In my opinion, this is exactly the situation described in the filed bug, and
>> > it's due to a 'limitation' of Cassini that does not behave like IIS.
>> > (Luckily, this is not a big deal for me, because in the production server I
>> > use IIS).
>>> > If you went deeper than me and found a different situation, file it by
>> > yourself, and please notify it to me, that I am very curoius!
>>> > (my e-mail is lorenzoaaa@.REMOVE_MEtiscali.it)
>>> > Bye
>> > Lorenzo
>>> > --
>> > Lorenzo
>>>> > "Juan T. Llibre" ha scritto:
>>> >> You never mentioned that you were talking about a Web Service.
>> >>
>> >> I tested on an aspx page, which is the *usual* type of "web application",
>> >> which is all you mentioned in your original post, so, yes, it does make for
>> >> "slightly different" testing conditions.
>> >>
>> >> Post webservice.asmx so we can dissect the code in it.
>> >> It dosn't have earth-shaking super-secret code in it, does it ?
>> >>
>> >>
>> >>
>> >>
>> >> Juan T. Llibre, asp.net MVP
>> >> aspnetfaq.com : http://www.aspnetfaq.com/
>> >> asp.net faq : http://asp.net.do/faq/
>> >> foros de asp.net, en espaol : http://asp.net.do/foros/
>> >> ===================================
>> >> "Lorenzo" <Lorenzo@.discussions.microsoft.com> wrote in message
>> >> news:BB12EEBF-1CEE-46D3-978C-AC47FA0D7CE9@.microsoft.com...
>> >> > Maybe I did a test sligthly different?
>> >>> >> > I Wasn't in debug mode.
>> >>> >> > In the first test, I tried opening IE and writing directly a path like this:
>> >> > http:\\localhost\Projects\2006\myapp\WebService.as mx
>> >> > (I use a WebService for the test: when invoked, it returns the path of a
>> >> > virtual directory, generated via Server.Mappath).
>> >> > This test works correctly!
>> >>> >> > In the second test, I tried opening IE and writing directly a path like this:
>> >> > http:\\localhost:1263\myapp\WebService.asmx
>> >> > (in this way I use Cassini, it's right?).
>> >> > In this test the problem happens!
>> >>> >> > I made some error?
>> >> > --
>> >> > Lorenzo
>> >>
>> >>
>> >> > "Juan T. Llibre" ha scritto:
>> >>> >> >> Actually, I did quite a bit of testing with IIS after I read your post.
>> >> >> It happens with IIS and I can repro it.
>> >> >>
>> >> >> You are mistaken about it only happening with Cassini.
>> >> >> File the bug or, if you are not up to it, I will.
>> >> >>
>> >> >>
>> >> >>
>> >> >>
>> >> >> Juan T. Llibre, asp.net MVP
>> >> >> aspnetfaq.com : http://www.aspnetfaq.com/
>> >> >> asp.net faq : http://asp.net.do/faq/
>> >> >> foros de asp.net, en espaol : http://asp.net.do/foros/
>> >> >> ===================================
>> >> >> "Lorenzo" <Lorenzo@.discussions.microsoft.com> wrote in message
>> >> >> news:7F193410-480A-412C-850D-311C53C23B0F@.microsoft.com...
>> >> >> > No, it happens only with Cassini, I just verified it!
>> >> >> > --
>> >> >> > Lorenzo
>> >> >>
>> >> >>
>> >> >> > "Juan T. Llibre" ha scritto:
>> >> >>> >> >> >> Yes, please bug it as happening under IIS, too.
>> >> >> >>
>> >> >> >>
>> >> >> >>
>> >> >> >> Juan T. Llibre, asp.net MVP
>> >> >> >> aspnetfaq.com : http://www.aspnetfaq.com/
>> >> >> >> asp.net faq : http://asp.net.do/faq/
>> >> >> >> foros de asp.net, en espaol : http://asp.net.do/foros/
>> >> >> >> ===================================
>> >> >> >> "Lorenzo" <Lorenzo@.discussions.microsoft.com> wrote in message
>> >> >> >> news:984E00A5-2CCB-4A8B-8FCD-870B9DAAC94B@.microsoft.com...
>> >> >> >> > The bug was already reported!
>> >> >> >>> >> >> >> > (see:
>> >> >> >> > http://lab.msdn.microsoft.com/produ...09-b8fb08d7cbd8
>> >> >> >> > )
>> >> >> >>> >> >> >> > Reading the answer i realized that this happens only in debug mode, due to
>> >> >> >> > the use, by VS2005, of Cassini; so I can fix it attaching to IIS instead of
>> >> >> >> > Cassini!
>> >> >> >> > Lorenzo
>> >> >> >>
>> >> >> >>
>> >> >> >> > "Juan T. Llibre" ha scritto:
>> >> >> >>> >> >> >> >> Good catch, Lorenzo.
>> >> >> >> >>
>> >> >> >> >> The behavior is as you describe it, and I agree that Server.MapPath should
>> >> >> >> >> reflect the true physical directory of a virtual directory within an Application.
>> >> >> >> >>
>> >> >> >> >> Please go to the Product Feedback Center :
>> >> >> >> >> http://lab.msdn.microsoft.com/produ...ck/default.aspx
>> >> >> >> >> and file a bug for that behavior.
>> >> >> >> >>
>> >> >> >> >> You will need a Passport account to file a bug at the Feedback Center.
>> >> >> >> >>
>> >> >> >> >> Thank you!
>> >> >> >> >>
>> >> >> >> >>
>> >> >> >> >>
>> >> >> >> >> Juan T. Llibre, asp.net MVP
>> >> >> >> >> aspnetfaq.com : http://www.aspnetfaq.com/
>> >> >> >> >> asp.net faq : http://asp.net.do/faq/
>> >> >> >> >> foros de asp.net, en espaol : http://asp.net.do/foros/
>> >> >> >> >> ===================================
>> >> >> >> >> "Lorenzo" <Lorenzo@.discussions.microsoft.com> wrote in message
>> >> >> >> >> news:7A8826EF-57CC-4474-A6B1-010E00B3CD70@.microsoft.com...
>> >> >> >> >> > Hello,
>> >> >> >> >>> >> >> >> >> > I have a web application with a virtual directory in it. With 'virtual
>> >> >> >> >> > directory' i mean
>> >> >> >> >> > a folder whose physical path is different from the physical path of the
>> >> >> >> >> > application, but in which Web Sharing is active.
>> >> >> >> >> > For example:
>> >> >> >> >> > my application is in "C:\Inetpub\wwwroot\MyApp",
>> >> >> >> >> > the Virtual folder is in "C:\VirtualFolder",
>> >> >> >> >> > and IIS sees it as if it were in "C:\Inetpub\wwwroot\MyApp\VirtualFolder".
>> >> >> >> >>> >> >> >> >> > How can I get, from code, the real physical path of the virtual folder?
>> >> >> >> >> > I tried with Server.Mappath, but I found that it returns
>> >> >> >> >> > "C:\Inetpub\wwwroot\MyApp\VirtualFolder", not "C:\VirtualFolder"
>> >> >> >> >>> >> >> >> >> > Thanks
>> >> >> >> >> > Lorenzo
>> >> >> >> >>> >> >> >> >> > --
>> >> >> >> >> > Lorenzo
>> >> >> >> >>
>> >> >> >> >>
>> >> >> >> >>
>> >> >> >>
>> >> >> >>
>> >> >> >>
>> >> >>
>> >> >>
>> >> >>
>> >>
>> >>
>> >>
>>
>>
>> .
>