473,624 Members | 2,069 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

can I grant write permissions to a folder for restricted user.

In my application, I want to copy some file from network location to local
machine folder. It works fine for administrator but If I run it with
restricted user (not having permissions to local machine folder) it gives me
Access denied error.
How can I programmaticall y give permission to the foder for restrcited user.
Nov 17 '05 #1
1 7752
Hello Kiran,
In my application, I want to copy some file from network location to local
machine folder. If I run it with restricted user it gives me Access denied
error.
How can I programmaticall y give permission to the foder for restrcited
user.


If you are using C# 2.0, you could use the
System.Security .AccessControl. FileSecurity class and its SetAccessRule
method (for example) to modify the Access Control List (ACL) of the folder
you want to write to.

However, if the restricted user is not allowed by the administrator to
change the permissions of the folder, then you are out of luck. Here's an
easy rule of thumb: if you cannot do something interactively (i.e. copy a
file to a folder), then you also cannot write code that would suddenly let
you write to that folder.

So you either need to give more permissions to the restricted user, or copy
your file to another folder.

Hope this helps.

--
Regards,

Mr. Jani Järvinen
C# MVP
Helsinki, Finland
ja***@removethi s.dystopia.fi
http://www.saunalahti.fi/janij/
Nov 17 '05 #2

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

Similar topics

3
3641
by: George Hester | last post by:
In Windows 2000 I need permissions set so that I can write a text file to the folder when the asp page is loaded. Right now I have only these permissions set: Administrator: Full System: Full Everyone: Read and Execute, List, Read Network: Read and Execute. List. Read Is there some other "user" that I can give permissions to to write a text file to the folder that doesn't allow write permissions to IUSER_MachineName? Thanks. --
1
2770
by: Brett | last post by:
We have an application where the iusr_<srvr> has write NTFS permissions to a folder under the wwwroot (i.e. wwwroot\folder) and also there is a SQL Server database where we must give the iusr_<srvr> read and write permissions on the database in order for the application to work. Anonymous access is enabled on the default web site where this web app is located. Because we are using the iusr is there simple exploit code that could allow...
0
1189
by: Markus | last post by:
hi, is there a way to set up an user, how only have restricted admin rights on mysql server. this user only should be able to create DBs (and drop them) and set grants on this new DB. i think with the standard mysql-privileges this can't be done. - when a user has the drop-priv he can drop ALL DBs in the server. - when a user has grant priv he can grant and revoke on all DBs... we have setup the root with a secret password, and want...
0
1552
by: Carlitos | last post by:
Hi there, I do not have much experience nor knowledge about security in ASP.NET nor Windows, so I apologize if I sound naive in this question. I developed a web application and a DLL that the web application uses. This DLL moves files from the web server to a shared folder in a different server in the intranet. It seems ASPNET user account can move some files but not all types of files because it does not have enough permissions to...
3
4381
by: frekster | last post by:
All. I have a folder/files that I have added asp.net to have read/write/etc. privlidges via the properties of the folder/files and security tab. However, when I run my asp.net page, I still get that access is denied. the path is c:\inetpub\app\bin\folder the "folder has a ton of files in it and every file in the folder must be able to be opened and binary read by the asp.net worker process.
2
3726
by: steggun | last post by:
Hello, I'm writing a C# windows form application and need some guidance on a couple of issues. First, my application needs to change the permissions on a folder. The application creates a local group and I need to give that group Full Control permissions to a folder on the file system. Would anyone know how to accomplish this?
6
39938
by: Fred W. | last post by:
When my application starts I need to check folder permissions to ensure they have "Full Control" before I let them proceed on. How can I check this permission. Thank you, Fred
1
8056
by: =?Utf-8?B?R2FuZXNoIE11dGh1dmVsdQ==?= | last post by:
Hello All, Our application write logs to a file in a folder. Before our application starts writing to that file, I want to check if the current user has write access to that file, for example, "c:\temp\LogFile.txt". I see several articles for setting file access permissions, getting file access permissions for a given user or current user - but the current user could also gain write access to the same file not just by explicit permssion...
3
8279
by: eholz1 | last post by:
Hello PHP Group, I am having trouble setting permissions correctly so that the magickwand api (php 5.2) can read and write images. I usually read a file from one directory, create a magickwand resource from that file, and transform the image, and save the new image with a new name to a different directory. I have seen that my file and folder permissions when set incorrectly,
0
8238
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8624
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8336
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8478
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7164
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
4082
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2607
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1786
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1485
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.