From ASPX page, can't access file on another PC on network

  • Thread starter Thread starter Ronald S. Cook
  • Start date Start date
R

Ronald S. Cook

In my .aspx page, I am trying to read file that is on a different on the
company network.



When I map a drive to it and call from within my .aspx page, I get this
error:



Could not find a part of the path 'Z:\Events.nss'.

Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information
about the error and where it originated in the code.

Exception Details: System.IO.DirectoryNotFoundException: Could not find a
part of the path 'Z:\Events.nss'.



When I put in the path as \\server\content\Events.nss, I get an error saying
I needed a username and password to be able to get to that place.



How can I get to this file?



Thanks for any help,

Ron
 
In my .aspx page, I am trying to read file that is on a different on the
company network.



When I map a drive to it and call from within my .aspx page, I get this
error:



Could not find a part of the path 'Z:\Events.nss'.

Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information
about the error and where it originated in the code.

Exception Details: System.IO.DirectoryNotFoundException: Could not find a
part of the path 'Z:\Events.nss'.



When I put in the path as \\server\content\Events.nss, I get an error saying
I needed a username and password to be able to get to that place.



How can I get to this file?



Thanks for any help,

Ron
That typically means you don't have permission to read that file. See your
system administrator.

Otis Mukinfus
http://www.arltex.com
http://www.tomchilders.com
 
The ASPNET user in your computer didn't have the permission to access file
on the remote computer.
The remote computer has to grant your ASPNET account to access that file.
 
| The ASPNET user in your computer didn't have the permission to access file
| on the remote computer.
| The remote computer has to grant your ASPNET account to access that file.
|

Which is not possible as ASPNET is a local account.

Willy.
 
Your mapped drive Z: is mapped in the context of the "interactive user"
session, not in the context of the ASPNET user or whatever user context your
Web application runs in.
You have to impersonate a user account that has the appropriate access
privileges to the remote share, and you should use UNC paths to access
remote files.
There are several way's to accomplish this, but the most appropriate is
through a COM+ server type component.

ASP.NET -----> COM+ server ------> Remote share
local user domain user/network user

Here you keep your asp.net application running as a local user, while your
COM+ application runs as a domain user or as a user (f.i a shadow account)
with appropriate access privs. to the remote share.


Willy.

| In my .aspx page, I am trying to read file that is on a different on the
| company network.
|
|
|
| When I map a drive to it and call from within my .aspx page, I get this
| error:
|
|
|
| Could not find a part of the path 'Z:\Events.nss'.
|
| Description: An unhandled exception occurred during the execution of the
| current web request. Please review the stack trace for more information
| about the error and where it originated in the code.
|
| Exception Details: System.IO.DirectoryNotFoundException: Could not find a
| part of the path 'Z:\Events.nss'.
|
|
|
| When I put in the path as \\server\content\Events.nss, I get an error
saying
| I needed a username and password to be able to get to that place.
|
|
|
| How can I get to this file?
|
|
|
| Thanks for any help,
|
| Ron
|
|
 
Yes, right, How about if two computer in the same domain ?
Can it be granted ? I am not sure...
 
What do you mean with "Can it be granted ?". A local account doesn't have
network access privileges at all. When running in a domain, you can
impersonate or run your web application as a domain user, but the latter is
something you should only do in a 'secure' environment (if that ever
exists), preferably you won't run a public web application as a domain user.
Note also that 'aspnet' is kind of a special account, you don't create
'aspnet' and you don't know it's password, it's called a 'machine account'
and such accounts have their passwords maintained by the security system in
the OS (or don't have passwords at all). Services that run as "aspnet", use
the "machine" name to access network resources when the machine is a members
of an AD domain (W2K or higher). That means that 'aspnet' can access
external resources, provided that you granted the 'machine account' access
privileges to the share.

Willy.

| Yes, right, How about if two computer in the same domain ?
| Can it be granted ? I am not sure...
|
| | >
| > | > | The ASPNET user in your computer didn't have the permission to access
| > file
| > | on the remote computer.
| > | The remote computer has to grant your ASPNET account to access that
| > file.
| > |
| >
| > Which is not possible as ASPNET is a local account.
| >
| > Willy.
| >
| >
|
|
 
Hi,

Willy Denoyette said:
| The ASPNET user in your computer didn't have the permission to access
file
| on the remote computer.
| The remote computer has to grant your ASPNET account to access that
file.
|

Which is not possible as ASPNET is a local account.


Worse, as it's running as a service cannot "mount" remote shares, you have
to use UNC to reach it.
 
Back
Top