473,407 Members | 2,306 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,407 software developers and data experts.

File permission issues

Hi,
I have a C#.Net 2.0 web app which needs to be able to read a bunch of
files from a user's computer, but I have not be able to get it to do so
without "Access denied" errors.
The main piece of code is simple
List<FileInfoAllFiles = new List<FileInfo>();

System.Security.Permissions.FileIOPermission MyPermissions = new
System.Security.Permissions.FileIOPermission
System.Security.Permissions.FileIOPermissionAccess .AllAccess,
ThisSourceDirectory.FullName);

MyPermissions.Assert();

foreach (FileInfo ThisFile in ThisSourceDirectory.GetFiles())

{

{

AllFiles.Add(ThisFile);

}

}

ThisSourceDirectory is on a networked drive to which everyone in the company
should have access.
I have set <identity impersonate = "true"/in my web.config file.
The page is running from IIS from my machine and I have Integrated Windows
Authentication turned on.
I have logged in as another user and I can see that
System.Environment.UserDomainName & System.Environment.UserName seem to be
set correctly.
The lines above in which I create and assert "MyPermissions" run without any
complaints, but the next line (with "GetFiles"), gives me access denied
errors.

When I log in as myself, everything runs just fine.

I would appreciate any help.

Thanks!

Ethan

Ethan Strauss Ph.D.
Bioinformatics Scientist
Promega Corporation
2800 Woods Hollow Rd.
Madison, WI 53711
608-274-4330
800-356-9526
et***********@promega.com
Jun 20 '07 #1
3 3564
Why not just make the folder a virtual directory in IIS under your web
application and set the proper permissions there?
-- Peter
Site: http://www.eggheadcafe.com
UnBlog: http://petesbloggerama.blogspot.com
Short urls & more: http://ittyurl.net


"Ethan Strauss" wrote:
Hi,
I have a C#.Net 2.0 web app which needs to be able to read a bunch of
files from a user's computer, but I have not be able to get it to do so
without "Access denied" errors.
The main piece of code is simple
List<FileInfoAllFiles = new List<FileInfo>();

System.Security.Permissions.FileIOPermission MyPermissions = new
System.Security.Permissions.FileIOPermission
System.Security.Permissions.FileIOPermissionAccess .AllAccess,
ThisSourceDirectory.FullName);

MyPermissions.Assert();

foreach (FileInfo ThisFile in ThisSourceDirectory.GetFiles())

{

{

AllFiles.Add(ThisFile);

}

}

ThisSourceDirectory is on a networked drive to which everyone in the company
should have access.
I have set <identity impersonate = "true"/in my web.config file.
The page is running from IIS from my machine and I have Integrated Windows
Authentication turned on.
I have logged in as another user and I can see that
System.Environment.UserDomainName & System.Environment.UserName seem to be
set correctly.
The lines above in which I create and assert "MyPermissions" run without any
complaints, but the next line (with "GetFiles"), gives me access denied
errors.

When I log in as myself, everything runs just fine.

I would appreciate any help.

Thanks!

Ethan

Ethan Strauss Ph.D.
Bioinformatics Scientist
Promega Corporation
2800 Woods Hollow Rd.
Madison, WI 53711
608-274-4330
800-356-9526
et***********@promega.com
Jun 20 '07 #2
That is essentially what I did for development of the functionality after
the upload, but I need users other than me to be able to upload batches of
files to process. I don't want them to have to ask me each time they have a
batch to deal with or to have to upload files individually. If there is a
way to allow them to transfer everything to a virtual directory, that might
work, but I don't know of a way to do that without having the app read the
files.
Thanks,
Ethan

"Peter Bromberg [C# MVP]" <pb*******@yahoo.yabbadabbadoo.comwrote in
message news:D8**********************************@microsof t.com...
Why not just make the folder a virtual directory in IIS under your web
application and set the proper permissions there?
-- Peter
Site: http://www.eggheadcafe.com
UnBlog: http://petesbloggerama.blogspot.com
Short urls & more: http://ittyurl.net


"Ethan Strauss" wrote:
>Hi,
I have a C#.Net 2.0 web app which needs to be able to read a bunch of
files from a user's computer, but I have not be able to get it to do so
without "Access denied" errors.
The main piece of code is simple
List<FileInfoAllFiles = new List<FileInfo>();

System.Security.Permissions.FileIOPermission MyPermissions =
new
System.Security.Permissions.FileIOPermission
System.Security.Permissions.FileIOPermissionAcces s.AllAccess,
ThisSourceDirectory.FullName);

MyPermissions.Assert();

foreach (FileInfo ThisFile in ThisSourceDirectory.GetFiles())

{

{

AllFiles.Add(ThisFile);

}

}

ThisSourceDirectory is on a networked drive to which everyone in the
company
should have access.
I have set <identity impersonate = "true"/in my web.config file.
The page is running from IIS from my machine and I have Integrated
Windows
Authentication turned on.
I have logged in as another user and I can see that
System.Environment.UserDomainName & System.Environment.UserName seem to
be
set correctly.
The lines above in which I create and assert "MyPermissions" run without
any
complaints, but the next line (with "GetFiles"), gives me access denied
errors.

When I log in as myself, everything runs just fine.

I would appreciate any help.

Thanks!

Ethan

Ethan Strauss Ph.D.
Bioinformatics Scientist
Promega Corporation
2800 Woods Hollow Rd.
Madison, WI 53711
608-274-4330
800-356-9526
et***********@promega.com

Jun 21 '07 #3
"Ethan Strauss" <ethan dot strauss at Promega dot comwrote in message
news:%2****************@TK2MSFTNGP03.phx.gbl...
That is essentially what I did for development of the functionality after
the upload, but I need users other than me to be able to upload batches of
files to process. I don't want them to have to ask me each time they have
a batch to deal with or to have to upload files individually. If there is
a way to allow them to transfer everything to a virtual directory, that
might work, but I don't know of a way to do that without having the app
read the files.
Thanks,
Ethan
We have a similar situation and so far we have elected to let the "project
manager" handle the upload. Eventually he (or she) will have the same
complaint you do: not haveing time to do the upload. We will be working on
that but right now is is not a problem.

Because our users frequently have a hierarchy they want to preserve, we
elected to let them use explorer to browse their directory and copy and
paste the entire structure into(for example) \\acqlib\INCOMING Our
"project manager" then runs a python script that moves the structure to
\\acqlib\data which is read only. It also lists all those files, the path
to the files and puts those paths (along with ownership info) into a
postgresql Sql Server Datebase (the same acqlib system). This is a linux
system that is "free" and the data and incoming are samba shares that the
windows users access. The web server is XP -Pro running IIs with the "free"
postgresql odbc drivers.

I did the web page project (aspx) and used VS2005. We have found that when
you have a microsoft network, and a microsoft trained network manager, if
you then have a linux based database system you find that the "network
manager" has very little say so about how it gets run. ie: it does not get
moved into his or her turf where you got to ask permission for every little
change.

As far as your access problems, I have found that if I can use explorer to
browse and "read" a file, then the web page works. If I cannot browse and
"read" the file, the IE7 or IE6 permissions are not set correctly or the
user is not "authenticated". Sometimes the event viewer gives a better
error message about why a directory cannot be listed or a file read on a
share.

HTH

--
================================================== ====================
Joseph "Beemer Biker" Stateson
http://TipsForTheComputingImpaired.com
http://ResearchRiders.org Ask about my 99'R1100RT
================================================== ====================

Jun 21 '07 #4

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

Similar topics

0
by: Fran Tirimo | last post by:
I am developing a small website using ASP scripts to format data retrieved from an Access database. It will run on a Windows 2003 server supporting FrontPage extensions 2002 hosted by the company...
2
by: Fran Tirimo | last post by:
I am developing a small website using ASP scripts to format data retrieved from an Access database. It will run on a Windows 2003 server supporting FrontPage extensions 2002 hosted by the company...
1
by: Chris | last post by:
I have seen the posts on various places on the internet about .NET framework mismatch issues and I don't think that is my problem. ; ) When I execute the following C++.NET code: String...
10
by: Raymond | last post by:
Hi All: To find a file exists using the file name, I have tow routings on UNIX system. 1. access(2) 2. lstat(2) This tow function also can do. When the return value is "-1" and errno is...
6
by: sambuela | last post by:
How can I write message to the file located in the wwwroot directory? It seems that IIS protect these files. Let make me cannot do the I/O writing sucessfully. I try to open file's write...
1
by: igotyourdotnet | last post by:
Ok, here is the issue: I have 2 web pages one does a file upload to a database and the other page does a FTP to a server, both pages use the c:\temp directory. The page that uploads to a database...
4
by: Mukesh | last post by:
Hi all I am trying to upload and save as a picture to "root/Photos" folder in my web application. I am using this code to perform this task DirectoryInfo strFolder = new...
5
by: Brian | last post by:
Hi I have a problem in opening url using 'file'. I searched many other discussion groups and tried suggestions, but could not resolve this problem. e.g <?php $myfile =...
5
by: =?Utf-8?B?UVNJRGV2ZWxvcGVy?= | last post by:
I have a .Net web service that converts the MODCA files to tif or png file format. This web service runs on a 2003 server. This web service first copies the MODCA file to be converted to a...
2
by: Visine_Eyes | last post by:
What .NET mechanism should I use to resolve permission issues before I begin to copy directory structure/file(s) from one computer to another. I have tried Try/Catch statement using DirectoryInfo...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.