How to access UNC from ASP.NET application?

S

Speech Lover

I have problem writing content to a UNC file from my ASP.NET 1.1
application. This is on Windows server 2003
The event log says "X:\temp\abc.txt path not found" and stuff.

Note that I have allowed Full Control permission on abc.txt on the other
machine.

any idea?

thanks,
Vince
 
J

Juan T. Llibre

re:
Note that I have allowed Full Control permission on abc.txt on the other machine.

To which account have you allowed full permissions to ?
To the ASP.NET account which is accessing the UNC file ?
 
S

Speech Lover

Say we have two servers: A & B.
On B, I do
1. Right click on C:\SharedFolder and share it out
2. Under Sharing - Permissions, I allow Everyone to have Full Control
3. Under Security, I adde an object Server-B\ASPNET and allow Full Control
to it. (I wanted to allow Server-A\ASPNET but can't change the location to
Server-A)

Then on A, I map X: drive to Server-B\SharedFolder and have my ASP.NET code
to write to X:\
I also tried using \\Server-B\SharedFolder but got the same problem.

Any comments are more than welcome

thanks,
Speech Lover
 
J

Juan T. Llibre

re:
3. Under Security, I adde an object Server-B\ASPNET and allow Full Control to it. (I wanted to
allow Server-A\ASPNET but can't change the location to Server-A)

The problem is that the account which is accessing B's C:\SharedFolder
is the one which needs access permissions.

If you can't grant access permissions on B's C:\SharedFolder to the A account
which ASP.NET is running as, ASP.NET will not be able to access that resource.
 
S

Speech Lover

I am just a newbie to networking.
From Server-B, I open up Network Places and I am able to see both Server-A
and Server-B under the same WORKGROUP.
I click on "Locations..." but I don't see Server-A there. Nor can I click
and browse a different location.

Could you tell me what I need to do to allow me to select a different server
from "Locations.."?

Many Thanks!
Speech Lover
 
S

Steve C. Orr [MCSD, MVP, CSM, ASP Insider]

I suggest you use impersonation to have ASP.NET run under a different user
account that has the necessary network access.
At first, for testing purposes, I'd suggest you have it run under your user
account since you know you have the required access to the folder.

<!-- Web.config file. -->
<identity impersonate="true" userName="Redmond\BillG" password="Melinda"/>
 
S

Speech Lover

Hi Steve,

Let me tell you more details:

A small WORKGROUP has two Windows Server 2003 servers - server A & server B.
I have installed an application on server A and by default it runs under
the
account "Network Service".
This application writes files to a local directory without any problem but
when
I use UNC format to write files to server B, it fails.

Note that on server B I have also granted full control permission to
account
"Network Service".

What needs to be done to allow "Network Service" account to write to a
network shared folder?

In WORKGROUP environment, shouldn't "Network Service" account on both
two servers take care of the authenticaion issue?

thanks,
Vince
 
J

Juan T. Llibre

Network Service is an account *local* to the W2K3 server.
Its identity isn't usable by other servers.

IOW, server A's "Network Service" account is local to Server A,
and cannot access Server B's shared folder.

re:
!> In WORKGROUP environment, shouldn't "Network Service" account on both
!> two servers take care of the authenticaion issue?

No. They are different accounts, local to each server.

Setup a user account on server A and, as Steve suggests,
impersonate that user and give that account access permissions to the shared folder.

As Steve suggested, write this entry in web.config :
<!-- Web.config file. -->

<identity impersonate="true" userName="ServerA\Accountname" password="pass"/>

Here's the instructions to create the service account :
http://msdn2.microsoft.com/en-us/library/ms998297.aspx

To be on the safe side, verify that the following ACLs have been set on Server A:
http://msdn2.microsoft.com/en-us/library/kwzs111e.aspx
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,053
Latest member
BrodieSola

Latest Threads

Top