Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > How to access UNC from ASP.NET application?

Reply
Thread Tools

How to access UNC from ASP.NET application?

 
 
Speech Lover
Guest
Posts: n/a
 
      04-18-2007
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


 
Reply With Quote
 
 
 
 
Juan T. Llibre
Guest
Posts: n/a
 
      04-19-2007
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 ?



Juan T. Llibre, asp.net MVP
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en espaņol : http://asp.net.do/foros/
===================================
"Speech Lover" <(E-Mail Removed)> wrote in message
news:%(E-Mail Removed)...
>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
>



 
Reply With Quote
 
 
 
 
Speech Lover
Guest
Posts: n/a
 
      04-19-2007
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



"Juan T. Llibre" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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 ?
>
>
>
> Juan T. Llibre, asp.net MVP
> asp.net faq : http://asp.net.do/faq/
> foros de asp.net, en espaņol : http://asp.net.do/foros/
> ===================================
> "Speech Lover" <(E-Mail Removed)> wrote in message
> news:%(E-Mail Removed)...
>>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
>>

>
>



 
Reply With Quote
 
Juan T. Llibre
Guest
Posts: n/a
 
      04-19-2007
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.






Juan T. Llibre, asp.net MVP
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en espaņol : http://asp.net.do/foros/
===================================
"Speech Lover" <(E-Mail Removed)> wrote in message
news:%(E-Mail Removed)...
> 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
>
>
>
> "Juan T. Llibre" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
>> 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 ?
>>
>>
>>
>> Juan T. Llibre, asp.net MVP
>> asp.net faq : http://asp.net.do/faq/
>> foros de asp.net, en espaņol : http://asp.net.do/foros/
>> ===================================
>> "Speech Lover" <(E-Mail Removed)> wrote in message
>> news:%(E-Mail Removed)...
>>>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
>>>

>>
>>

>
>



 
Reply With Quote
 
Speech Lover
Guest
Posts: n/a
 
      04-19-2007
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


"Juan T. Llibre" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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.
>
>
>
>
>
>
> Juan T. Llibre, asp.net MVP
> asp.net faq : http://asp.net.do/faq/
> foros de asp.net, en espaņol : http://asp.net.do/foros/
> ===================================
> "Speech Lover" <(E-Mail Removed)> wrote in message
> news:%(E-Mail Removed)...
>> 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
>>
>>
>>
>> "Juan T. Llibre" <(E-Mail Removed)> wrote in message
>> news:(E-Mail Removed)...
>>> 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 ?
>>>
>>>
>>>
>>> Juan T. Llibre, asp.net MVP
>>> asp.net faq : http://asp.net.do/faq/
>>> foros de asp.net, en espaņol : http://asp.net.do/foros/
>>> ===================================
>>> "Speech Lover" <(E-Mail Removed)> wrote in message
>>> news:%(E-Mail Removed)...
>>>>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
>>>>
>>>
>>>

>>
>>

>
>



 
Reply With Quote
 
Steve C. Orr [MCSD, MVP, CSM, ASP Insider]
Guest
Posts: n/a
 
      04-19-2007
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"/>

--
I hope this helps,
Steve C. Orr,
MCSD, MVP, CSM, ASPInsider
http://SteveOrr.net


"Speech Lover" <(E-Mail Removed)> wrote in message
news:%(E-Mail Removed)...
>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
>


 
Reply With Quote
 
Speech Lover
Guest
Posts: n/a
 
      04-19-2007
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


"Steve C. Orr [MCSD, MVP, CSM, ASP Insider]" <(E-Mail Removed)> wrote in
message news(E-Mail Removed)...
>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"/>
>
> --
> I hope this helps,
> Steve C. Orr,
> MCSD, MVP, CSM, ASPInsider
> http://SteveOrr.net
>
>
> "Speech Lover" <(E-Mail Removed)> wrote in message
> news:%(E-Mail Removed)...
>>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
>>

>



 
Reply With Quote
 
Juan T. Llibre
Guest
Posts: n/a
 
      04-19-2007
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







Juan T. Llibre, asp.net MVP
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en espaņol : http://asp.net.do/foros/
===================================
"Speech Lover" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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
>
>
> "Steve C. Orr [MCSD, MVP, CSM, ASP Insider]" <(E-Mail Removed)> wrote in message
> news(E-Mail Removed)...
>>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"/>
>>
>> --
>> I hope this helps,
>> Steve C. Orr,
>> MCSD, MVP, CSM, ASPInsider
>> http://SteveOrr.net
>>
>>
>> "Speech Lover" <(E-Mail Removed)> wrote in message
>> news:%(E-Mail Removed)...
>>>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
>>>

>>

>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: How include a large array? Edward A. Falk C Programming 1 04-04-2013 08:07 PM
Network file UNC Access from Web Application mcrose ASP .Net 0 10-20-2006 04:54 AM
Could not find a part of the path when access a remote server via mapped drive or unc AL ASP .Net 0 10-14-2004 08:12 AM
How to get system.IO access to UNC resources using virtual directory configuration SERVER SIDE? Dwaine ASP .Net 0 02-16-2004 11:53 PM
Trouble on creating a new web project - UNC share does not exist or you do not have access Simon Chung-Jen Chuang ASP .Net 1 08-23-2003 11:01 AM



Advertisments