473,395 Members | 1,348 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,395 software developers and data experts.

ASP.NET Accessing shares

Hi,

I'm working on an ASP.NET application that allows users to upload images to
a central storage area and view using a HTTP handler.

This works great if the files are stored on a local drive on the web server.
The problem I have is that when I move this storage area to a share on
another machine with full permissions for everyone I still get
System.IO.FileNotFoundException.

Are there any other additional other permissions for the ASPNET account on
the web server that need to be set before I can access remote shares?

Many thanks
Nov 19 '05 #1
11 1274
Hi,

have you try to add the ASPNET group to your share folder permission ?

"Oliver" wrote:
Hi,

I'm working on an ASP.NET application that allows users to upload images to
a central storage area and view using a HTTP handler.

This works great if the files are stored on a local drive on the web server.
The problem I have is that when I move this storage area to a share on
another machine with full permissions for everyone I still get
System.IO.FileNotFoundException.

Are there any other additional other permissions for the ASPNET account on
the web server that need to be set before I can access remote shares?

Many thanks

Nov 19 '05 #2
Hello serge,
Hi,

have you try to add the ASPNET group to your share folder permission ?


I have, and it still doesn't work. I'm trying the solution presented at http://www.15seconds.com/issue/030926.htm
Nov 19 '05 #3
Serge,

The machines are not part of a domain so the ASPNET account is only on the
web server and therefore I cannot give permissions to the user directly on
the share.

Going to read article posted by flipdoubt.

Thanks
"serge calderara" wrote:
Hi,

have you try to add the ASPNET group to your share folder permission ?

Nov 19 '05 #4
Oliver wrote:
Hi,

I'm working on an ASP.NET application that allows users to upload
images to a central storage area and view using a HTTP handler.

This works great if the files are stored on a local drive on the web
server. The problem I have is that when I move this storage area to a
share on another machine with full permissions for everyone I still
get System.IO.FileNotFoundException.

Are there any other additional other permissions for the ASPNET
account on the web server that need to be set before I can access
remote shares?


In a scenario like this, you should use P/Invoke to do code-level
impersonation. You can then impersonate a user (or group) who has access to
that share.

http://support.microsoft.com/default...B;EN-US;306158

See "Impersonate a specific user in code".

--
Jim Cheshire
JIMCO Software
http://www.jimcosoftware.com

FrontPage add-ins for FrontPage 2000 - 2003


Nov 19 '05 #5
First, the FileNotFoundException doesn't indicate a problem with
permissions. It means that the file cannot be found. In other words, your
path is wrong.

The best way to access a network share is to use a UNC path (e.g.
\\192.168.1.1\c$\somefolder\somefile.txt).

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
Neither a follower nor a lender be.

"Oliver" <Ol****@discussions.microsoft.com> wrote in message
news:79**********************************@microsof t.com...
Hi,

I'm working on an ASP.NET application that allows users to upload images
to
a central storage area and view using a HTTP handler.

This works great if the files are stored on a local drive on the web
server.
The problem I have is that when I move this storage area to a share on
another machine with full permissions for everyone I still get
System.IO.FileNotFoundException.

Are there any other additional other permissions for the ASPNET account on
the web server that need to be set before I can access remote shares?

Many thanks

Nov 19 '05 #6
Kevin Spencer wrote:
First, the FileNotFoundException doesn't indicate a problem with
permissions. It means that the file cannot be found. In other words,
your path is wrong.


It is possible to see a FileNotFoundException when you are experiencing
permissions problems.

--
Jim Cheshire
JIMCO Software
http://www.jimcosoftware.com

FrontPage add-ins for FrontPage 2000 - 2003


Nov 19 '05 #7
I agree, I can open the file by pasting the UNC into explorer no problem -
just not through ASP.NET

"JIMCO Software" wrote:
Kevin Spencer wrote:
First, the FileNotFoundException doesn't indicate a problem with
permissions. It means that the file cannot be found. In other words,
your path is wrong.


It is possible to see a FileNotFoundException when you are experiencing
permissions problems.

--
Jim Cheshire
JIMCO Software
http://www.jimcosoftware.com

FrontPage add-ins for FrontPage 2000 - 2003


Nov 19 '05 #8
Jim,

I was really trying to avoid having modify the application to impersonate a
user (not lazy just time constraints). So I just opened the share for full
access by everyone but no luck. At this rate it will quicker to re-write the
code.

"JIMCO Software" wrote:

In a scenario like this, you should use P/Invoke to do code-level
impersonation. You can then impersonate a user (or group) who has access to
that share.

http://support.microsoft.com/default...B;EN-US;306158

See "Impersonate a specific user in code".

--
Jim Cheshire
JIMCO Software
http://www.jimcosoftware.com

FrontPage add-ins for FrontPage 2000 - 2003


Nov 19 '05 #9
Oliver wrote:
Jim,

I was really trying to avoid having modify the application to
impersonate a user (not lazy just time constraints). So I just opened
the share for full access by everyone but no luck. At this rate it
will quicker to re-write the code.


If you are not impersonating, that means that the worker process account is
being used to access the share. It's possible that it's failing because of
that. I would set a password for the process account and then configure an
identical account on the file server. This will allow for pass-through
authentication.

--
Jim Cheshire
JIMCO Software
http://www.jimcosoftware.com

FrontPage add-ins for FrontPage 2000 - 2003


Nov 19 '05 #10
I was not aware of that. I suppose that the permissions exception might be
found in the InnerException. At any rate, I stand corrected!

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
Neither a follower nor a lender be.

"JIMCO Software" <co*******@jimcosoftware.com> wrote in message
news:%2***************@TK2MSFTNGP15.phx.gbl...
Kevin Spencer wrote:
First, the FileNotFoundException doesn't indicate a problem with
permissions. It means that the file cannot be found. In other words,
your path is wrong.


It is possible to see a FileNotFoundException when you are experiencing
permissions problems.

--
Jim Cheshire
JIMCO Software
http://www.jimcosoftware.com

FrontPage add-ins for FrontPage 2000 - 2003

Nov 19 '05 #11
Hi Oliver,

Apparently I was mistaken. If it is indeed a permissions issue, your ASP.Net
app may be running under a local machine account, rather then a
domain-accessible account. The following MSDN article will provide you with
the information you need to access a network share via the ASP.Net user
account:

http://msdn.microsoft.com/library/de...l/THCMCh19.asp

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
Neither a follower nor a lender be.

"Oliver" <Ol****@discussions.microsoft.com> wrote in message
news:BB**********************************@microsof t.com...
I agree, I can open the file by pasting the UNC into explorer no problem -
just not through ASP.NET

"JIMCO Software" wrote:
Kevin Spencer wrote:
> First, the FileNotFoundException doesn't indicate a problem with
> permissions. It means that the file cannot be found. In other words,
> your path is wrong.
>


It is possible to see a FileNotFoundException when you are experiencing
permissions problems.

--
Jim Cheshire
JIMCO Software
http://www.jimcosoftware.com

FrontPage add-ins for FrontPage 2000 - 2003


Nov 19 '05 #12

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

Similar topics

5
by: Egor Bolonev | last post by:
import os print os.listdir("\\\\delta\\public") outputs and import os print os.listdir("\\\\delta")
1
by: Doran_Dermot | last post by:
Hi All, I'm currently using "os.listdir" to obtain the contents of some slow Windows shares. I think I've seen another way of doing this using the win32 library but I can't find the example...
23
by: Lamberti Fabrizio | last post by:
Hi all, I've to access to a network file from an asp pages. I've red a lot of things on old posts and on Microsoft article but I can't still solve my problem. I've got two server inside the...
36
by: Thomas | last post by:
after spending countless hours trying, i give up and hope to get some help in here. on server1 i got the web myweb.com with my test.asp. in the test.asp, i'm trying to read a file from an UNC...
3
by: diephouse | last post by:
I seem to be having a problem accessing networks shares. For example, I try the following code: File.Exists(@"\\SERVER\share"); always returns false! Or even if I map the drive ...
0
by: Ram | last post by:
Hey, I want to get a list of all the file shares on a server in my ActiveDirectory domain, Is there a way of doing so with the DirectoryServices namespace or the ADSI COM object? Note: My server...
1
by: Craig | last post by:
My team is building an application in VS.NET 2005. To avoid a monolithic app and spread the development workload, we have a relatively small framework application that instantiates module...
4
by: frikk | last post by:
I previously posted about accessing SharePoint over the web. Well I have since given up any easy means of doing this, since something else has perked my interest. Instead of going to...
19
by: cj | last post by:
I'm getting terrible response times trying to pull data from VFP tables using .net--like 2 minutes! Can someone help? f:\arcust01 currently contains 187,728 records and is indexed on CUSTNO...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.