471,602 Members | 1,364 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,602 software developers and data experts.

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

--
Lorenzo
Mar 22 '06 #1
14 12478
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/produc...k/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" <Lo*****@discussions.microsoft.com> wrote in message
news:7A**********************************@microsof t.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

Mar 22 '06 #2
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/produc...k/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" <Lo*****@discussions.microsoft.com> wrote in message
news:7A**********************************@microsof t.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


Mar 22 '06 #3
The bug was already reported!

(see:
http://lab.msdn.microsoft.com/produc...9-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/produc...k/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" <Lo*****@discussions.microsoft.com> wrote in message
news:7A**********************************@microsof t.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


Mar 22 '06 #4
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 espa˝ol : http://asp.net.do/foros/
===================================
"Lorenzo" <Lo*****@discussions.microsoft.com> wrote in message
news:60**********************************@microsof t.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/produc...k/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" <Lo*****@discussions.microsoft.com> wrote in message
news:7A**********************************@microsof t.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


Mar 22 '06 #5
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" <Lo*****@discussions.microsoft.com> wrote in message
news:98**********************************@microsof t.com...
The bug was already reported!

(see:
http://lab.msdn.microsoft.com/produc...9-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/produc...k/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" <Lo*****@discussions.microsoft.com> wrote in message
news:7A**********************************@microsof t.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


Mar 22 '06 #6
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" <Lo*****@discussions.microsoft.com> wrote in message
news:98**********************************@microsof t.com...
The bug was already reported!

(see:
http://lab.msdn.microsoft.com/produc...9-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/produc...k/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" <Lo*****@discussions.microsoft.com> wrote in message
news:7A**********************************@microsof t.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


Mar 22 '06 #7
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" <Lo*****@discussions.microsoft.com> wrote in message
news:7F**********************************@microsof t.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" <Lo*****@discussions.microsoft.com> wrote in message
news:98**********************************@microsof t.com...
> The bug was already reported!
>
> (see:
> http://lab.msdn.microsoft.com/produc...9-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/produc...k/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" <Lo*****@discussions.microsoft.com> wrote in message
>> news:7A**********************************@microsof t.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
>>
>>
>>


Mar 22 '06 #8
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" <Lo*****@discussions.microsoft.com> wrote in message
news:7F**********************************@microsof t.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" <Lo*****@discussions.microsoft.com> wrote in message
news:98**********************************@microsof t.com...
> The bug was already reported!
>
> (see:
> http://lab.msdn.microsoft.com/produc...9-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/produc...k/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" <Lo*****@discussions.microsoft.com> wrote in message
>> news:7A**********************************@microsof t.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
>>
>>
>>


Mar 23 '06 #9
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" <Lo*****@discussions.microsoft.com> wrote in message
news:BB**********************************@microsof t.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" <Lo*****@discussions.microsoft.com> wrote in message
news:7F**********************************@microsof t.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" <Lo*****@discussions.microsoft.com> wrote in message
>> news:98**********************************@microsof t.com...
>> > The bug was already reported!
>> >
>> > (see:
>> > http://lab.msdn.microsoft.com/produc...9-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/produc...k/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" <Lo*****@discussions.microsoft.com> wrote in message
>> >> news:7A**********************************@microsof t.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
>> >>
>> >>
>> >>
>>
>>
>>


Mar 23 '06 #10
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" <Lo*****@discussions.microsoft.com> wrote in message
news:BB**********************************@microsof t.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" <Lo*****@discussions.microsoft.com> wrote in message
news:7F**********************************@microsof t.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" <Lo*****@discussions.microsoft.com> wrote in message
>> news:98**********************************@microsof t.com...
>> > The bug was already reported!
>> >
>> > (see:
>> > http://lab.msdn.microsoft.com/produc...9-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/produc...k/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" <Lo*****@discussions.microsoft.com> wrote in message
>> >> news:7A**********************************@microsof t.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
>> >>
>> >>
>> >>
>>
>>
>>


Mar 23 '06 #11
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" <Lo*****@discussions.microsoft.com> wrote in message
news:BB**********************************@microsof t.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" <Lo*****@discussions.microsoft.com> wrote in message
news:7F**********************************@microsof t.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" <Lo*****@discussions.microsoft.com> wrote in message
>> news:98**********************************@microsof t.com...
>> > The bug was already reported!
>> >
>> > (see:
>> > http://lab.msdn.microsoft.com/produc...9-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/produc...k/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" <Lo*****@discussions.microsoft.com> wrote in message
>> >> news:7A**********************************@microsof t.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
>> >>
>> >>
>> >>
>>
>>
>>


Mar 24 '06 #12
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" <Lo*****@discussions.microsoft.com> wrote in message
news:A6**********************************@microsof t.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" <Lo*****@discussions.microsoft.com> wrote in message
news:BB**********************************@microsof t.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" <Lo*****@discussions.microsoft.com> wrote in message
>> news:7F**********************************@microsof t.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" <Lo*****@discussions.microsoft.com> wrote in message
>> >> news:98**********************************@microsof t.com...
>> >> > The bug was already reported!
>> >> >
>> >> > (see:
>> >> > http://lab.msdn.microsoft.com/produc...9-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/produc...k/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" <Lo*****@discussions.microsoft.com> wrote in message
>> >> >> news:7A**********************************@microsof t.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
>> >> >>
>> >> >>
>> >> >>
>> >>
>> >>
>> >>
>>
>>
>>


Mar 24 '06 #13
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" <Lo*****@discussions.microsoft.com> wrote in message
news:A6**********************************@microsof t.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" <Lo*****@discussions.microsoft.com> wrote in message
news:BB**********************************@microsof t.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" <Lo*****@discussions.microsoft.com> wrote in message
>> news:7F**********************************@microsof t.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" <Lo*****@discussions.microsoft.com> wrote in message
>> >> news:98**********************************@microsof t.com...
>> >> > The bug was already reported!
>> >> >
>> >> > (see:
>> >> > http://lab.msdn.microsoft.com/produc...9-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/produc...k/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" <Lo*****@discussions.microsoft.com> wrote in message
>> >> >> news:7A**********************************@microsof t.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
>> >> >>
>> >> >>
>> >> >>
>> >>
>> >>
>> >>
>>
>>
>>

.

Mar 24 '06 #14
That's why it's a bug!

Please file a bug report at :

http://lab.msdn.microsoft.com/produc...k/default.aspx

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

http://lab.msdn.microsoft.com/produc...9-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 espa˝ol : http://asp.net.do/foros/
===================================
"Lorenzo" <Lo*****@discussions.microsoft.com> wrote in message
news:D1**********************************@microsof t.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 espa˝ol : http://asp.net.do/foros/
===================================
"Lorenzo" <Lo*****@discussions.microsoft.com> wrote in message
news:A6**********************************@microsof t.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" <Lo*****@discussions.microsoft.com> wrote in message
>> news:BB**********************************@microsof t.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" <Lo*****@discussions.microsoft.com> wrote in message
>> >> news:7F**********************************@microsof t.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" <Lo*****@discussions.microsoft.com> wrote in message
>> >> >> news:98**********************************@microsof t.com...
>> >> >> > The bug was already reported!
>> >> >> >
>> >> >> > (see:
>> >> >> > http://lab.msdn.microsoft.com/produc...9-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/produc...k/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" <Lo*****@discussions.microsoft.com> wrote in message
>> >> >> >> news:7A**********************************@microsof t.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
>> >> >> >>
>> >> >> >>
>> >> >> >>
>> >> >>
>> >> >>
>> >> >>
>> >>
>> >>
>> >>
>>
>>
>>

.

Mar 24 '06 #15

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

13 posts views Thread by John Rebbeck | last post: by
10 posts views Thread by Kenneth P | last post: by
3 posts views Thread by Cozmo | last post: by
11 posts views Thread by brett | last post: by
4 posts views Thread by vunet.us | last post: by
6 posts views Thread by withers | last post: by
reply views Thread by MichaelMortimer | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.