Showing posts with label network. Show all posts
Showing posts with label network. Show all posts

Tuesday, March 13, 2012

server.mappath and network shares

That is because Server.MapPath doesn't know anything about IIS's MetaData an
d where that actual path is located. Either you're going to have to hard co
de it in as a UNC path, or create some utility that will read the MetaData o
f IIS to get the actual phy
sical location.
Matt Hawley, MCAD .NET
http://www.eworldui.net
My IIS Web site has a virtual directory called content mapped to a network
share. If the home directory of the Web site is c:\inetpub\wwwroot and the
virtual directory maps to the network share \\myserver\content,
Server.MapPath is returning c:\inetpub\wwwroot\content rather than
\\myserver\content.
I've tried adding
<identity impersonate="true" userName="name" password="password"/>
to the web.config file in order to make sure the identity of the account
accessing network resources has appropriate rights, but that doesn't change
the path returned by MapPath.
Does anyone know what's wrong?But converting a virtual path to a physical path is exactly what mappath
should do. It certainly does it for local files, and that requires reading
metadata.
I've seen other posts on the group that indicate it does work the way I want
it to for some people.
-Jay
"Matt Hawley" <mhawley@.n!o!s!p!a!m.integrityts.com> wrote in message
news:OGFAk6%23GEHA.3068@.TK2MSFTNGP11.phx.gbl...
> That is because Server.MapPath doesn't know anything about IIS's MetaData
and where that actual path is located. Either you're going to have to hard
code it in as a UNC path, or create some utility that will read the MetaData
of IIS to get the actual physical location.
> Matt Hawley, MCAD .NET
> http://www.eworldui.net
> My IIS Web site has a virtual directory called content mapped to a
network
> share. If the home directory of the Web site is c:\inetpub\wwwroot and
the
> virtual directory maps to the network share \\myserver\content,
> Server.MapPath is returning c:\inetpub\wwwroot\content rather than
> \\myserver\content.
> I've tried adding
> <identity impersonate="true" userName="name" password="password"/>
> to the web.config file in order to make sure the identity of the account
> accessing network resources has appropriate rights, but that doesn't
change
> the path returned by MapPath.
> Does anyone know what's wrong?
>
>
>
Hi Jay,
Thanks for your followup. Regarding on this issue, I've done a general test
on my side and found the Server.MapPath did return the UNCPath of the
remote server(where the asp.net files and assemlby actually locate). Here
are the detailed enviroment infos on my test:
1. Remote shared Machine: Win2k server with .net framework1.1 installed
shared one folder as the root folder of a certain web application.
2. Server Host Machine(where host the webapplication in IIS): WinXP
Professional with .net framework1.1 installed. And the two machines are in
the same domain so When creating the virutal directory on the XP box, I
paste the certain UNC path (\\servername\sharedfoldername) and then select
a DomainAccount which are administrator on both machine. Then, when I visit
the page in the web application and the page has the following code in
Page_Load:
Response.Write("<br>" + Server.MapPath("."));
Then, the output display the certain UNC path on the WIN2K
mathine((\\servername\sharedfoldername) rather than the physical path on
the WINXP BOX. I've also tried the contrary( share a folder on the XP box
and host the IIS Virutal Directory on the WIN2K machine, still use the
DomainAccount when accessing the UNC folder
in IIS manager).
So I think you may have a check on the above steps I listed to see whether
they can provide any clues. Also, I recommend that you also perform such a
test on your side to see whether it works. Thanks.
Regards,
Steven Cheng
Microsoft Online Support
Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
Get Preview at ASP.NET whidbey
http://msdn.microsoft.com/asp.net/whidbey/default.aspx
Steven-
Rather than have the whole site located on a share from a remote machine,
can you create a Web site locally, then create a virtual directory under the
site that points to a remote machine share?
-Jay
"Steven Cheng[MSFT]" <v-schang@.online.microsoft.com> wrote in message
news:vnIAo%23UHEHA.3444@.cpmsftngxa06.phx.gbl...
> Hi Jay,
> Thanks for your followup. Regarding on this issue, I've done a general
test
> on my side and found the Server.MapPath did return the UNCPath of the
> remote server(where the asp.net files and assemlby actually locate). Here
> are the detailed enviroment infos on my test:
> 1. Remote shared Machine: Win2k server with .net framework1.1 installed
> shared one folder as the root folder of a certain web application.
> 2. Server Host Machine(where host the webapplication in IIS): WinXP
> Professional with .net framework1.1 installed. And the two machines are
in
> the same domain so When creating the virutal directory on the XP box, I
> paste the certain UNC path (\\servername\sharedfoldername) and then select
> a DomainAccount which are administrator on both machine. Then, when I
visit
> the page in the web application and the page has the following code in
> Page_Load:
> Response.Write("<br>" + Server.MapPath("."));
> Then, the output display the certain UNC path on the WIN2K
> mathine((\\servername\sharedfoldername) rather than the physical path on
> the WINXP BOX. I've also tried the contrary( share a folder on the XP box
> and host the IIS Virutal Directory on the WIN2K machine, still use the
> DomainAccount when accessing the UNC folder
> in IIS manager).
> So I think you may have a check on the above steps I listed to see whether
> they can provide any clues. Also, I recommend that you also perform such a
> test on your side to see whether it works. Thanks.
> Regards,
> Steven Cheng
> Microsoft Online Support
> Get Secure! www.microsoft.com/security
> (This posting is provided "AS IS", with no warranties, and confers no
> rights.)
> Get Preview at ASP.NET whidbey
> http://msdn.microsoft.com/asp.net/whidbey/default.aspx
>
>
Hi Jay,
In fact, my test is just Virutal Directory based rather than site based. I
just create a Virutal Directory under the local IIS's default site and set
its "Network Directory" path as a UNC path on another remote machine.
However, I think the key point should be the "Connect As.." account , I
used a PowerFull Domain account which has the administrator permission on
the remote machine. So I think we may have a further check on the
security. Do you think so? Thanks.
Regards,
Steven Cheng
Microsoft Online Support
Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
Get Preview at ASP.NET whidbey
http://msdn.microsoft.com/asp.net/whidbey/default.aspx
Hi Jay,
Have you got any further ideas on this issue? If you have anything unclear
or if there're anything else we can help, please feel free to post here.
Thanks.
Regards,
Steven Cheng
Microsoft Online Support
Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
Get Preview at ASP.NET whidbey
http://msdn.microsoft.com/asp.net/whidbey/default.aspx

server.mappath and network shares

My IIS Web site has a virtual directory called content mapped to a network
share. If the home directory of the Web site is c:\inetpub\wwwroot and the
virtual directory maps to the network share \\myserver\content,
Server.MapPath is returning c:\inetpub\wwwroot\content rather than
\\myserver\content.

I've tried adding
<identity impersonate="true" userName="name" password="password"/
to the web.config file in order to make sure the identity of the account
accessing network resources has appropriate rights, but that doesn't change
the path returned by MapPath.

Does anyone know what's wrong?Hi Jay,

I'm viewing the thread and found that it is a duplicated one with another
post(has the same title) in this newsgroup. I've posted a reply and
provided some of my test results in that thread. Would you please have a
check there. Also, if you have any questoins, please feel free to post in
either ones. Thanks.

Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Get Preview at ASP.NET whidbey
http://msdn.microsoft.com/asp.net/whidbey/default.aspx

server.mappath and network shares

My IIS Web site has a virtual directory called content mapped to a network
share. If the home directory of the Web site is c:\inetpub\wwwroot and the
virtual directory maps to the network share \\myserver\content,
Server.MapPath is returning c:\inetpub\wwwroot\content rather than
\\myserver\content.

I've tried adding
<identity impersonate="true" userName="name" password="password"/
to the web.config file in order to make sure the identity of the account
accessing network resources has appropriate rights, but that doesn't change
the path returned by MapPath.

Does anyone know what's wrong?That is because Server.MapPath doesn't know anything about IIS's MetaData and where that actual path is located. Either you're going to have to hard code it in as a UNC path, or create some utility that will read the MetaData of IIS to get the actual physical location.

Matt Hawley, MCAD .NET
http://www.eworldui.net

My IIS Web site has a virtual directory called content mapped to a network
share. If the home directory of the Web site is c:\inetpub\wwwroot and the
virtual directory maps to the network share \\myserver\content,
Server.MapPath is returning c:\inetpub\wwwroot\content rather than
\\myserver\content.

I've tried adding
<identity impersonate="true" userName="name" password="password"/
to the web.config file in order to make sure the identity of the account
accessing network resources has appropriate rights, but that doesn't change
the path returned by MapPath.

Does anyone know what's wrong?
That is because Server.MapPath doesn't know anything about IIS's MetaData and where that actual path is located. Either you're going to have to hard code it in as a UNC path, or create some utility that will read the MetaData of IIS to get the actual physical location.

Matt Hawley, MCAD .NET
http://www.eworldui.net

My IIS Web site has a virtual directory called content mapped to a network
share. If the home directory of the Web site is c:\inetpub\wwwroot and the
virtual directory maps to the network share \\myserver\content,
Server.MapPath is returning c:\inetpub\wwwroot\content rather than
\\myserver\content.

I've tried adding
<identity impersonate="true" userName="name" password="password"/
to the web.config file in order to make sure the identity of the account
accessing network resources has appropriate rights, but that doesn't change
the path returned by MapPath.

Does anyone know what's wrong?
But converting a virtual path to a physical path is exactly what mappath
should do. It certainly does it for local files, and that requires reading
metadata.

I've seen other posts on the group that indicate it does work the way I want
it to for some people.

-Jay

"Matt Hawley" <mhawley@.n!o!s!p!a!m.integrityts.com> wrote in message
news:OGFAk6%23GEHA.3068@.TK2MSFTNGP11.phx.gbl...
> That is because Server.MapPath doesn't know anything about IIS's MetaData
and where that actual path is located. Either you're going to have to hard
code it in as a UNC path, or create some utility that will read the MetaData
of IIS to get the actual physical location.
> Matt Hawley, MCAD .NET
> http://www.eworldui.net
> My IIS Web site has a virtual directory called content mapped to a
network
> share. If the home directory of the Web site is c:\inetpub\wwwroot and
the
> virtual directory maps to the network share \\myserver\content,
> Server.MapPath is returning c:\inetpub\wwwroot\content rather than
> \\myserver\content.
> I've tried adding
> <identity impersonate="true" userName="name" password="password"/>
> to the web.config file in order to make sure the identity of the account
> accessing network resources has appropriate rights, but that doesn't
change
> the path returned by MapPath.
> Does anyone know what's wrong?
>
But converting a virtual path to a physical path is exactly what mappath
should do. It certainly does it for local files, and that requires reading
metadata.

I've seen other posts on the group that indicate it does work the way I want
it to for some people.

-Jay

"Matt Hawley" <mhawley@.n!o!s!p!a!m.integrityts.com> wrote in message
news:OGFAk6%23GEHA.3068@.TK2MSFTNGP11.phx.gbl...
> That is because Server.MapPath doesn't know anything about IIS's MetaData
and where that actual path is located. Either you're going to have to hard
code it in as a UNC path, or create some utility that will read the MetaData
of IIS to get the actual physical location.
> Matt Hawley, MCAD .NET
> http://www.eworldui.net
> My IIS Web site has a virtual directory called content mapped to a
network
> share. If the home directory of the Web site is c:\inetpub\wwwroot and
the
> virtual directory maps to the network share \\myserver\content,
> Server.MapPath is returning c:\inetpub\wwwroot\content rather than
> \\myserver\content.
> I've tried adding
> <identity impersonate="true" userName="name" password="password"/>
> to the web.config file in order to make sure the identity of the account
> accessing network resources has appropriate rights, but that doesn't
change
> the path returned by MapPath.
> Does anyone know what's wrong?
>
Hi Jay,

Thanks for your followup. Regarding on this issue, I've done a general test
on my side and found the Server.MapPath did return the UNCPath of the
remote server(where the asp.net files and assemlby actually locate). Here
are the detailed enviroment infos on my test:
1. Remote shared Machine: Win2k server with .net framework1.1 installed
shared one folder as the root folder of a certain web application.

2. Server Host Machine(where host the webapplication in IIS): WinXP
Professional with .net framework1.1 installed. And the two machines are in
the same domain so When creating the virutal directory on the XP box, I
paste the certain UNC path (\\servername\sharedfoldername) and then select
a DomainAccount which are administrator on both machine. Then, when I visit
the page in the web application and the page has the following code in
Page_Load:
Response.Write("<br>" + Server.MapPath("."));

Then, the output display the certain UNC path on the WIN2K
mathine((\\servername\sharedfoldername) rather than the physical path on
the WINXP BOX. I've also tried the contrary( share a folder on the XP box
and host the IIS Virutal Directory on the WIN2K machine, still use the
DomainAccount when accessing the UNC folder
in IIS manager).

So I think you may have a check on the above steps I listed to see whether
they can provide any clues. Also, I recommend that you also perform such a
test on your side to see whether it works. Thanks.

Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Get Preview at ASP.NET whidbey
http://msdn.microsoft.com/asp.net/whidbey/default.aspx
Hi Jay,

Thanks for your followup. Regarding on this issue, I've done a general test
on my side and found the Server.MapPath did return the UNCPath of the
remote server(where the asp.net files and assemlby actually locate). Here
are the detailed enviroment infos on my test:
1. Remote shared Machine: Win2k server with .net framework1.1 installed
shared one folder as the root folder of a certain web application.

2. Server Host Machine(where host the webapplication in IIS): WinXP
Professional with .net framework1.1 installed. And the two machines are in
the same domain so When creating the virutal directory on the XP box, I
paste the certain UNC path (\\servername\sharedfoldername) and then select
a DomainAccount which are administrator on both machine. Then, when I visit
the page in the web application and the page has the following code in
Page_Load:
Response.Write("<br>" + Server.MapPath("."));

Then, the output display the certain UNC path on the WIN2K
mathine((\\servername\sharedfoldername) rather than the physical path on
the WINXP BOX. I've also tried the contrary( share a folder on the XP box
and host the IIS Virutal Directory on the WIN2K machine, still use the
DomainAccount when accessing the UNC folder
in IIS manager).

So I think you may have a check on the above steps I listed to see whether
they can provide any clues. Also, I recommend that you also perform such a
test on your side to see whether it works. Thanks.

Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Get Preview at ASP.NET whidbey
http://msdn.microsoft.com/asp.net/whidbey/default.aspx
Steven-

Rather than have the whole site located on a share from a remote machine,
can you create a Web site locally, then create a virtual directory under the
site that points to a remote machine share?

-Jay

"Steven Cheng[MSFT]" <v-schang@.online.microsoft.com> wrote in message
news:vnIAo%23UHEHA.3444@.cpmsftngxa06.phx.gbl...
> Hi Jay,
> Thanks for your followup. Regarding on this issue, I've done a general
test
> on my side and found the Server.MapPath did return the UNCPath of the
> remote server(where the asp.net files and assemlby actually locate). Here
> are the detailed enviroment infos on my test:
> 1. Remote shared Machine: Win2k server with .net framework1.1 installed
> shared one folder as the root folder of a certain web application.
> 2. Server Host Machine(where host the webapplication in IIS): WinXP
> Professional with .net framework1.1 installed. And the two machines are
in
> the same domain so When creating the virutal directory on the XP box, I
> paste the certain UNC path (\\servername\sharedfoldername) and then select
> a DomainAccount which are administrator on both machine. Then, when I
visit
> the page in the web application and the page has the following code in
> Page_Load:
> Response.Write("<br>" + Server.MapPath("."));
> Then, the output display the certain UNC path on the WIN2K
> mathine((\\servername\sharedfoldername) rather than the physical path on
> the WINXP BOX. I've also tried the contrary( share a folder on the XP box
> and host the IIS Virutal Directory on the WIN2K machine, still use the
> DomainAccount when accessing the UNC folder
> in IIS manager).
> So I think you may have a check on the above steps I listed to see whether
> they can provide any clues. Also, I recommend that you also perform such a
> test on your side to see whether it works. Thanks.
> Regards,
> Steven Cheng
> Microsoft Online Support
> Get Secure! www.microsoft.com/security
> (This posting is provided "AS IS", with no warranties, and confers no
> rights.)
> Get Preview at ASP.NET whidbey
> http://msdn.microsoft.com/asp.net/whidbey/default.aspx
>
Steven-

Rather than have the whole site located on a share from a remote machine,
can you create a Web site locally, then create a virtual directory under the
site that points to a remote machine share?

-Jay

"Steven Cheng[MSFT]" <v-schang@.online.microsoft.com> wrote in message
news:vnIAo%23UHEHA.3444@.cpmsftngxa06.phx.gbl...
> Hi Jay,
> Thanks for your followup. Regarding on this issue, I've done a general
test
> on my side and found the Server.MapPath did return the UNCPath of the
> remote server(where the asp.net files and assemlby actually locate). Here
> are the detailed enviroment infos on my test:
> 1. Remote shared Machine: Win2k server with .net framework1.1 installed
> shared one folder as the root folder of a certain web application.
> 2. Server Host Machine(where host the webapplication in IIS): WinXP
> Professional with .net framework1.1 installed. And the two machines are
in
> the same domain so When creating the virutal directory on the XP box, I
> paste the certain UNC path (\\servername\sharedfoldername) and then select
> a DomainAccount which are administrator on both machine. Then, when I
visit
> the page in the web application and the page has the following code in
> Page_Load:
> Response.Write("<br>" + Server.MapPath("."));
> Then, the output display the certain UNC path on the WIN2K
> mathine((\\servername\sharedfoldername) rather than the physical path on
> the WINXP BOX. I've also tried the contrary( share a folder on the XP box
> and host the IIS Virutal Directory on the WIN2K machine, still use the
> DomainAccount when accessing the UNC folder
> in IIS manager).
> So I think you may have a check on the above steps I listed to see whether
> they can provide any clues. Also, I recommend that you also perform such a
> test on your side to see whether it works. Thanks.
> Regards,
> Steven Cheng
> Microsoft Online Support
> Get Secure! www.microsoft.com/security
> (This posting is provided "AS IS", with no warranties, and confers no
> rights.)
> Get Preview at ASP.NET whidbey
> http://msdn.microsoft.com/asp.net/whidbey/default.aspx
>
Hi Jay,

In fact, my test is just Virutal Directory based rather than site based. I
just create a Virutal Directory under the local IIS's default site and set
its "Network Directory" path as a UNC path on another remote machine.
However, I think the key point should be the "Connect As.." account , I
used a PowerFull Domain account which has the administrator permission on
the remote machine. So I think we may have a further check on the
security. Do you think so? Thanks.

Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Get Preview at ASP.NET whidbey
http://msdn.microsoft.com/asp.net/whidbey/default.aspx
Hi Jay,

In fact, my test is just Virutal Directory based rather than site based. I
just create a Virutal Directory under the local IIS's default site and set
its "Network Directory" path as a UNC path on another remote machine.
However, I think the key point should be the "Connect As.." account , I
used a PowerFull Domain account which has the administrator permission on
the remote machine. So I think we may have a further check on the
security. Do you think so? Thanks.

Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Get Preview at ASP.NET whidbey
http://msdn.microsoft.com/asp.net/whidbey/default.aspx
Hi Jay,

Have you got any further ideas on this issue? If you have anything unclear
or if there're anything else we can help, please feel free to post here.
Thanks.

Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Get Preview at ASP.NET whidbey
http://msdn.microsoft.com/asp.net/whidbey/default.aspx

server.mappath and network shares

My IIS Web site has a virtual directory called content mapped to a network
share. If the home directory of the Web site is c:\inetpub\wwwroot and the
virtual directory maps to the network share \\myserver\content,
Server.MapPath is returning c:\inetpub\wwwroot\content rather than
\\myserver\content.

I've tried adding
<identity impersonate="true" userName="name" password="password"/
to the web.config file in order to make sure the identity of the account
accessing network resources has appropriate rights, but that doesn't change
the path returned by MapPath.

Does anyone know what's wrong?Hi Jay,

I'm viewing the thread and found that it is a duplicated one with another
post(has the same title) in this newsgroup. I've posted a reply and
provided some of my test results in that thread. Would you please have a
check there. Also, if you have any questoins, please feel free to post in
either ones. Thanks.

Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Get Preview at ASP.NET whidbey
http://msdn.microsoft.com/asp.net/whidbey/default.aspx
Hi Jay,

I'm viewing the thread and found that it is a duplicated one with another
post(has the same title) in this newsgroup. I've posted a reply and
provided some of my test results in that thread. Would you please have a
check there. Also, if you have any questoins, please feel free to post in
either ones. Thanks.

Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Get Preview at ASP.NET whidbey
http://msdn.microsoft.com/asp.net/whidbey/default.aspx

server.mappath and network shares

My IIS Web site has a virtual directory called content mapped to a network
share. If the home directory of the Web site is c:\inetpub\wwwroot and the
virtual directory maps to the network share \\myserver\content,
Server.MapPath is returning c:\inetpub\wwwroot\content rather than
\\myserver\content.

I've tried adding
<identity impersonate="true" userName="name" password="password"/
to the web.config file in order to make sure the identity of the account
accessing network resources has appropriate rights, but that doesn't change
the path returned by MapPath.

Does anyone know what's wrong?Hi Jay,

I'm viewing the thread and found that it is a duplicated one with another
post(has the same title) in this newsgroup. I've posted a reply and
provided some of my test results in that thread. Would you please have a
check there. Also, if you have any questoins, please feel free to post in
either ones. Thanks.

Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Get Preview at ASP.NET whidbey
http://msdn.microsoft.com/asp.net/whidbey/default.aspx

server.mappath and network shares

My IIS Web site has a virtual directory called content mapped to a network
share. If the home directory of the Web site is c:\inetpub\wwwroot and the
virtual directory maps to the network share \\myserver\content,
Server.MapPath is returning c:\inetpub\wwwroot\content rather than
\\myserver\content.

I've tried adding
<identity impersonate="true" userName="name" password="password"/
to the web.config file in order to make sure the identity of the account
accessing network resources has appropriate rights, but that doesn't change
the path returned by MapPath.

Does anyone know what's wrong?That is because Server.MapPath doesn't know anything about IIS's MetaData and where that actual path is located. Either you're going to have to hard code it in as a UNC path, or create some utility that will read the MetaData of IIS to get the actual physical location.

Matt Hawley, MCAD .NET
http://www.eworldui.net

My IIS Web site has a virtual directory called content mapped to a network
share. If the home directory of the Web site is c:\inetpub\wwwroot and the
virtual directory maps to the network share \\myserver\content,
Server.MapPath is returning c:\inetpub\wwwroot\content rather than
\\myserver\content.

I've tried adding
<identity impersonate="true" userName="name" password="password"/
to the web.config file in order to make sure the identity of the account
accessing network resources has appropriate rights, but that doesn't change
the path returned by MapPath.

Does anyone know what's wrong?
But converting a virtual path to a physical path is exactly what mappath
should do. It certainly does it for local files, and that requires reading
metadata.

I've seen other posts on the group that indicate it does work the way I want
it to for some people.

-Jay

"Matt Hawley" <mhawley@.n!o!s!p!a!m.integrityts.com> wrote in message
news:OGFAk6%23GEHA.3068@.TK2MSFTNGP11.phx.gbl...
> That is because Server.MapPath doesn't know anything about IIS's MetaData
and where that actual path is located. Either you're going to have to hard
code it in as a UNC path, or create some utility that will read the MetaData
of IIS to get the actual physical location.
> Matt Hawley, MCAD .NET
> http://www.eworldui.net
> My IIS Web site has a virtual directory called content mapped to a
network
> share. If the home directory of the Web site is c:\inetpub\wwwroot and
the
> virtual directory maps to the network share \\myserver\content,
> Server.MapPath is returning c:\inetpub\wwwroot\content rather than
> \\myserver\content.
> I've tried adding
> <identity impersonate="true" userName="name" password="password"/>
> to the web.config file in order to make sure the identity of the account
> accessing network resources has appropriate rights, but that doesn't
change
> the path returned by MapPath.
> Does anyone know what's wrong?
>
Hi Jay,

Thanks for your followup. Regarding on this issue, I've done a general test
on my side and found the Server.MapPath did return the UNCPath of the
remote server(where the asp.net files and assemlby actually locate). Here
are the detailed enviroment infos on my test:
1. Remote shared Machine: Win2k server with .net framework1.1 installed
shared one folder as the root folder of a certain web application.

2. Server Host Machine(where host the webapplication in IIS): WinXP
Professional with .net framework1.1 installed. And the two machines are in
the same domain so When creating the virutal directory on the XP box, I
paste the certain UNC path (\\servername\sharedfoldername) and then select
a DomainAccount which are administrator on both machine. Then, when I visit
the page in the web application and the page has the following code in
Page_Load:
Response.Write("<br>" + Server.MapPath("."));

Then, the output display the certain UNC path on the WIN2K
mathine((\\servername\sharedfoldername) rather than the physical path on
the WINXP BOX. I've also tried the contrary( share a folder on the XP box
and host the IIS Virutal Directory on the WIN2K machine, still use the
DomainAccount when accessing the UNC folder
in IIS manager).

So I think you may have a check on the above steps I listed to see whether
they can provide any clues. Also, I recommend that you also perform such a
test on your side to see whether it works. Thanks.

Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Get Preview at ASP.NET whidbey
http://msdn.microsoft.com/asp.net/whidbey/default.aspx
Steven-

Rather than have the whole site located on a share from a remote machine,
can you create a Web site locally, then create a virtual directory under the
site that points to a remote machine share?

-Jay

"Steven Cheng[MSFT]" <v-schang@.online.microsoft.com> wrote in message
news:vnIAo%23UHEHA.3444@.cpmsftngxa06.phx.gbl...
> Hi Jay,
> Thanks for your followup. Regarding on this issue, I've done a general
test
> on my side and found the Server.MapPath did return the UNCPath of the
> remote server(where the asp.net files and assemlby actually locate). Here
> are the detailed enviroment infos on my test:
> 1. Remote shared Machine: Win2k server with .net framework1.1 installed
> shared one folder as the root folder of a certain web application.
> 2. Server Host Machine(where host the webapplication in IIS): WinXP
> Professional with .net framework1.1 installed. And the two machines are
in
> the same domain so When creating the virutal directory on the XP box, I
> paste the certain UNC path (\\servername\sharedfoldername) and then select
> a DomainAccount which are administrator on both machine. Then, when I
visit
> the page in the web application and the page has the following code in
> Page_Load:
> Response.Write("<br>" + Server.MapPath("."));
> Then, the output display the certain UNC path on the WIN2K
> mathine((\\servername\sharedfoldername) rather than the physical path on
> the WINXP BOX. I've also tried the contrary( share a folder on the XP box
> and host the IIS Virutal Directory on the WIN2K machine, still use the
> DomainAccount when accessing the UNC folder
> in IIS manager).
> So I think you may have a check on the above steps I listed to see whether
> they can provide any clues. Also, I recommend that you also perform such a
> test on your side to see whether it works. Thanks.
> Regards,
> Steven Cheng
> Microsoft Online Support
> Get Secure! www.microsoft.com/security
> (This posting is provided "AS IS", with no warranties, and confers no
> rights.)
> Get Preview at ASP.NET whidbey
> http://msdn.microsoft.com/asp.net/whidbey/default.aspx
>
Hi Jay,

In fact, my test is just Virutal Directory based rather than site based. I
just create a Virutal Directory under the local IIS's default site and set
its "Network Directory" path as a UNC path on another remote machine.
However, I think the key point should be the "Connect As.." account , I
used a PowerFull Domain account which has the administrator permission on
the remote machine. So I think we may have a further check on the
security. Do you think so? Thanks.

Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Get Preview at ASP.NET whidbey
http://msdn.microsoft.com/asp.net/whidbey/default.aspx

server.mappath and network shares

My IIS Web site has a virtual directory called content mapped to a network
share. If the home directory of the Web site is c:\inetpub\wwwroot and the
virtual directory maps to the network share \\myserver\content,
Server.MapPath is returning c:\inetpub\wwwroot\content rather than
\\myserver\content.
I've tried adding
<identity impersonate="true" userName="name" password="password"/>
to the web.config file in order to make sure the identity of the account
accessing network resources has appropriate rights, but that doesn't change
the path returned by MapPath.
Does anyone know what's wrong?Hi Jay,
I'm viewing the thread and found that it is a duplicated one with another
post(has the same title) in this newsgroup. I've posted a reply and
provided some of my test results in that thread. Would you please have a
check there. Also, if you have any questoins, please feel free to post in
either ones. Thanks.
Regards,
Steven Cheng
Microsoft Online Support
Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
Get Preview at ASP.NET whidbey
http://msdn.microsoft.com/asp.net/whidbey/default.aspx

server.mappath and network shares

My IIS Web site has a virtual directory called content mapped to a network
share. If the home directory of the Web site is c:\inetpub\wwwroot and the
virtual directory maps to the network share \\myserver\content,
Server.MapPath is returning c:\inetpub\wwwroot\content rather than
\\myserver\content.

I've tried adding
<identity impersonate="true" userName="name" password="password"/
to the web.config file in order to make sure the identity of the account
accessing network resources has appropriate rights, but that doesn't change
the path returned by MapPath.

Does anyone know what's wrong?That is because Server.MapPath doesn't know anything about IIS's MetaData and where that actual path is located. Either you're going to have to hard code it in as a UNC path, or create some utility that will read the MetaData of IIS to get the actual physical location.

Matt Hawley, MCAD .NET
http://www.eworldui.net

My IIS Web site has a virtual directory called content mapped to a network
share. If the home directory of the Web site is c:\inetpub\wwwroot and the
virtual directory maps to the network share \\myserver\content,
Server.MapPath is returning c:\inetpub\wwwroot\content rather than
\\myserver\content.

I've tried adding
<identity impersonate="true" userName="name" password="password"/
to the web.config file in order to make sure the identity of the account
accessing network resources has appropriate rights, but that doesn't change
the path returned by MapPath.

Does anyone know what's wrong?
But converting a virtual path to a physical path is exactly what mappath
should do. It certainly does it for local files, and that requires reading
metadata.

I've seen other posts on the group that indicate it does work the way I want
it to for some people.

-Jay

"Matt Hawley" <mhawley@.n!o!s!p!a!m.integrityts.com> wrote in message
news:OGFAk6%23GEHA.3068@.TK2MSFTNGP11.phx.gbl...
> That is because Server.MapPath doesn't know anything about IIS's MetaData
and where that actual path is located. Either you're going to have to hard
code it in as a UNC path, or create some utility that will read the MetaData
of IIS to get the actual physical location.
> Matt Hawley, MCAD .NET
> http://www.eworldui.net
> My IIS Web site has a virtual directory called content mapped to a
network
> share. If the home directory of the Web site is c:\inetpub\wwwroot and
the
> virtual directory maps to the network share \\myserver\content,
> Server.MapPath is returning c:\inetpub\wwwroot\content rather than
> \\myserver\content.
> I've tried adding
> <identity impersonate="true" userName="name" password="password"/>
> to the web.config file in order to make sure the identity of the account
> accessing network resources has appropriate rights, but that doesn't
change
> the path returned by MapPath.
> Does anyone know what's wrong?
>
Hi Jay,

Thanks for your followup. Regarding on this issue, I've done a general test
on my side and found the Server.MapPath did return the UNCPath of the
remote server(where the asp.net files and assemlby actually locate). Here
are the detailed enviroment infos on my test:
1. Remote shared Machine: Win2k server with .net framework1.1 installed
shared one folder as the root folder of a certain web application.

2. Server Host Machine(where host the webapplication in IIS): WinXP
Professional with .net framework1.1 installed. And the two machines are in
the same domain so When creating the virutal directory on the XP box, I
paste the certain UNC path (\\servername\sharedfoldername) and then select
a DomainAccount which are administrator on both machine. Then, when I visit
the page in the web application and the page has the following code in
Page_Load:
Response.Write("<br>" + Server.MapPath("."));

Then, the output display the certain UNC path on the WIN2K
mathine((\\servername\sharedfoldername) rather than the physical path on
the WINXP BOX. I've also tried the contrary( share a folder on the XP box
and host the IIS Virutal Directory on the WIN2K machine, still use the
DomainAccount when accessing the UNC folder
in IIS manager).

So I think you may have a check on the above steps I listed to see whether
they can provide any clues. Also, I recommend that you also perform such a
test on your side to see whether it works. Thanks.

Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Get Preview at ASP.NET whidbey
http://msdn.microsoft.com/asp.net/whidbey/default.aspx
Steven-

Rather than have the whole site located on a share from a remote machine,
can you create a Web site locally, then create a virtual directory under the
site that points to a remote machine share?

-Jay

"Steven Cheng[MSFT]" <v-schang@.online.microsoft.com> wrote in message
news:vnIAo%23UHEHA.3444@.cpmsftngxa06.phx.gbl...
> Hi Jay,
> Thanks for your followup. Regarding on this issue, I've done a general
test
> on my side and found the Server.MapPath did return the UNCPath of the
> remote server(where the asp.net files and assemlby actually locate). Here
> are the detailed enviroment infos on my test:
> 1. Remote shared Machine: Win2k server with .net framework1.1 installed
> shared one folder as the root folder of a certain web application.
> 2. Server Host Machine(where host the webapplication in IIS): WinXP
> Professional with .net framework1.1 installed. And the two machines are
in
> the same domain so When creating the virutal directory on the XP box, I
> paste the certain UNC path (\\servername\sharedfoldername) and then select
> a DomainAccount which are administrator on both machine. Then, when I
visit
> the page in the web application and the page has the following code in
> Page_Load:
> Response.Write("<br>" + Server.MapPath("."));
> Then, the output display the certain UNC path on the WIN2K
> mathine((\\servername\sharedfoldername) rather than the physical path on
> the WINXP BOX. I've also tried the contrary( share a folder on the XP box
> and host the IIS Virutal Directory on the WIN2K machine, still use the
> DomainAccount when accessing the UNC folder
> in IIS manager).
> So I think you may have a check on the above steps I listed to see whether
> they can provide any clues. Also, I recommend that you also perform such a
> test on your side to see whether it works. Thanks.
> Regards,
> Steven Cheng
> Microsoft Online Support
> Get Secure! www.microsoft.com/security
> (This posting is provided "AS IS", with no warranties, and confers no
> rights.)
> Get Preview at ASP.NET whidbey
> http://msdn.microsoft.com/asp.net/whidbey/default.aspx
>
Hi Jay,

In fact, my test is just Virutal Directory based rather than site based. I
just create a Virutal Directory under the local IIS's default site and set
its "Network Directory" path as a UNC path on another remote machine.
However, I think the key point should be the "Connect As.." account , I
used a PowerFull Domain account which has the administrator permission on
the remote machine. So I think we may have a further check on the
security. Do you think so? Thanks.

Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Get Preview at ASP.NET whidbey
http://msdn.microsoft.com/asp.net/whidbey/default.aspx
Hi Jay,

Have you got any further ideas on this issue? If you have anything unclear
or if there're anything else we can help, please feel free to post here.
Thanks.

Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Get Preview at ASP.NET whidbey
http://msdn.microsoft.com/asp.net/whidbey/default.aspx

server.mappath error

I am trying to use server.mappath to update a text file on another network drive on the same network as the server the application is running on. Security shouldn't be a problem but I am getting an error. Hereis my Code
 Dim FILENAME As String = server.MapPath("http://appl-08/TB/Test/test.txt")
Dim objStreamWriter As StreamWriter
objStreamWriter = File.CreateText(FILENAME )
objStreamWriter.WriteLine("Note form user")
objStreamWriter.WriteLine(txttext.Text)

I have also tried just mapPath("address"), mapPath ("\\appl-08\wwwroot\TB\test\test.txt")
This is the error I always get!!
Invalid path for MapPath 'http://appl-08/TB/Test/test.txt'. A virtual path is expected.

ANyone got any suggestions.Server.MapPath("TB/Test/test.txt") - assuming the file your working on is in the "appl-08" server root directory directory

If it's in the TB directory then "Test/test.txt"
this is the problem I am working on server appl-07 I need to store the file on appl-08
In which case i would imagine that you have a security issue anyway as you will need to give the ASP account on appl-07 permission to access the folder on appl-08

and then it should be somethign like CreateText("//appl-08/test/test.txt")

I think thats it anyhow i've tried to recreate it on our corporate network to find out for sure but our security settings are too strict for me to do that. It does however find the folder - it just doesn't give me permission to do anything with it.
Ok I can get it to work going to our sql server but not our .net server.
On both servers I created a folder gave it the same permmisions and on the .net server I get the error that I am using the wrong user name or password.
Is there some program that can't be installed or has to be installed for it to work.
perhaps using the .Net account of one machine to access another machine with it's own .Net account is conflicting it?
I dont' know to be honest - Hopefully someone else can help on that one