?
Solved

System.UnauthorizedAccessException

Posted on 2006-04-10
7
Medium Priority
?
352 Views
Last Modified: 2008-02-01
I am getting the below error when i am trying read a file on the desktop. I am able to read the file on any other location. Can you tell me why i am getting this error.

System.UnauthorizedAccessException: Access to the path 'C:\Documents and Settings\XXXXX\Desktop\kk\XXXXX86.JPG' is denied.


Here is the statement i am using to read the file.

System.IO.FileStream stream = new System.IO.FileStream(file,
                                                                            FileMode.Open,
                                                                            FileAccess.Read);
0
Comment
Question by:k_kosaraju
  • 3
4 Comments
 
LVL 10

Expert Comment

by:aki4u
ID: 16418419
Do you have read-only attribute unchecked?
Are you/asp.net included in Security tab and what permissions you have set?
0
 

Author Comment

by:k_kosaraju
ID: 16418510
yes read only is unchecked.

where i need to set the security permissions.

I launched my application online. When i try to read the file which is not on desktop i am getting this error.

System.IO.IOException: The device is not ready.

if i try to read the file on desktop i am getting this error

System.IO.DirectoryNotFoundException:
0
 
LVL 10

Accepted Solution

by:
aki4u earned 500 total points
ID: 16418629
System.IO.IOException: The device is not ready...is probably because you are trying to access C drive on the server
System.IO.DirectoryNotFoundException ...error is self explanatory

security permissions:
file properties->security tab
0
 
LVL 10

Expert Comment

by:aki4u
ID: 16620029
solution provided
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my asp.net applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
Sometimes in DotNetNuke module development you want to swap controls within the same module definition.  In doing this DNN (somewhat annoyingly) swaps the Skin and Container definitions to the default admin selections.  To get around this you need t…
this video summaries big data hadoop online training demo (http://onlineitguru.com/big-data-hadoop-online-training-placement.html) , and covers basics in big data hadoop .
With just a little bit of  SQL and VBA, many doors open to cool things like synchronize a list box to display data relevant to other information on a form.  If you have never written code or looked at an SQL statement before, no problem! ...  give i…
Suggested Courses
Course of the Month13 days, 18 hours left to enroll

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question