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

How to give read write permission to file in C#

Shafi hashmi
i have a windows application which has a feature to create and delete files on the system.

when i run the application every thing is working fine but when i create installer for it and after installing the application, i cant create and delete the files due to security issu..

if i run my program as administrator i can do the same in all drice except 'C:'

how can i make this workable after installation?
Sep 8 '11 #1
1 9179
hi friends my problem is resolved........

the problem was that when i was cerating files from the installed application the file was created with 'Hidden' and 'ReadOnly' attributes. hence it could not be deleted from the application. i was getting 'Access denied' error.

i resolved this by writing this code when file is created.

Expand|Select|Wrap|Line Numbers
  1. File.SetAttributes("fileName", FileAttributes.Normal);
Sep 9 '11 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: zhushenli | last post by:
Hello all, How to random read/write the file in fstream? BTW, how to access the file in block? Regards, Davy
5
by: Martin Svensson | last post by:
Hello! I need some help/recommendations on how to do the following. I have a program that writes an IP address two control numbers and a date to file, on one line. It's a basic text file and it...
8
by: Patrik Malmström | last post by:
How do I read, write a file binary? I want to open, say, file.exe read it in to the program, then write it out to file2.exe. Like file copy, anyone have a code sample?
2
by: Paul M | last post by:
Hy all In c# how can I read/write ini file? I need this for back compatibility. Is possible little example? For future, what is the best practice to replace ini file? app.config? xml files??...
2
by: Chen Zhuo | last post by:
Hi, I need to write some code to test whether a folder has read/write permission. The idea is to try to read sub-directories in this folder, if succeed, then test whether it's read-only. Any...
2
by: Urs Eichmann | last post by:
We're developing a standard software application (ASP.NET) which will run on servers of various ISP in a shared/hosted environment. With the ISP I usually work with it is no problem to get a folder...
0
by: Ahmed A. | last post by:
This will be very helpfull for many! Using RichTextBox Read/Write Unicode File http://www.microsoft.com/indonesia/msdn/wnf_RichTextBox.as p Private Function ReadFile(ByVal myfile As String)...
2
by: David Lozzi | last post by:
Howdy, Trying to open and read/write another aspx file from my aspx page. Basically I want to be able to update my aspx files from the website. Here's my code so far: Dim path As String =...
13
by: ravitunk | last post by:
hi friends, Can anyone tell me how to give read/write permissions to users based on their role(present in a table of SQL Server2000) in ASP.net?....please help me out....Thks for any help..
9
mickey0
by: mickey0 | last post by:
Hi, I have one problem; I must read a html like this; <html> <body> Hello </body> </html> I read this in a string (correct?) and after I have to do some changes to it and write it on disk...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
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,...
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...

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.