473,320 Members | 1,978 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

server.mappath and network shares

JR
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?


Nov 18 '05 #1
5 7028
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?

Nov 18 '05 #2
JR
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:OG****************@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?


Nov 18 '05 #3
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


Nov 18 '05 #4
JR
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-******@online.microsoft.com> wrote in message
news:vn****************@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

Nov 18 '05 #5
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

Nov 18 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: MikeT | last post by:
I need to start a lengthy file copy process going on our intranet server from a .asp page. Since the .asp cannot wait for this to complete - it might take anything up to half an hour - I've been...
6
by: JR | last post by:
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...
1
by: SL | last post by:
How do I set up access to a file on a Windows Server 2003 Domain Controller that also has IIS? The file sits on another server. The Domain Controller / IIS server connects to this file through a...
1
by: lecnac | last post by:
Here's some details: Server and workstation both in the same workgroup Logged into server as local Administrator Logged into workstation as a local user that is only in the Users group The...
1
by: lecnac | last post by:
Sorry for the repost. I must have done something wrong when I tried to post my reply (I can't seem to find it). Anyway, I'd really appreciate any help that anyone could provide. My issue is...
1
by: gnusmsa | last post by:
ASP.NET 2.0 (C#) application Using Windows authentication and impersonation Windows Server 2003 (IIS6) Server is a member server on a domain Logged into server as a domain user that is in the...
6
by: tendim | last post by:
G'day group. Currently our organization us using VB6 based applications, and I am trying to push forward and migrate some of the smaller things to VB.NET, eventually migrating all applications...
0
by: NoWhereMan | last post by:
Hello, I'm trying to get the list of shared folders of a network computer and add them to a combo box. I'm using the bellow code in VB .NET. Code ==== Private Sub EnumShares(ByVal Machine As...
11
by: brett | last post by:
I use two test servers and one production. I have a Utilities class that holds many of the links used through the site. One of the variables in this class is assigned the domain name. I need to...
5
by: lmttag | last post by:
ASP.NET 2.0 (C#) application Intranet application (not on the Internet) Using Windows authentication and impersonation Windows Server 2003 (IIS6) Server is a member server on a domain Logged...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....

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.