Access Denied Error In WinForms App

scott.ferguson

New member
Joined
Sep 6, 2006
Messages
3
Location
New Zealand
Programming Experience
3-5
Hi,
I have created a WinForms app that needs to save a file to my hard
drive.

Whenever I try to save a file I recieve an "access to the path <my
path> is denied" error.

I have used the .Net configuration wizard to check the permissions
granted to my assembly. The wizard reports the assemble has
"unrestricted" rights.

I have tried to save to "My Documents", Desktop and the bin of the apps
directory with the same results.

I have checked the permissions on c drive and "Everyone" is set to full
access.

I have tried other applications and i have created a new application
and I recieve the same error message.

Something has changed as I used to be able to write to the c: drive
with no problems. I do not know what I have done to cause this.

I have found plenty of topics about this error for Asp.Net but not for
Windows Forms. I don't think the Asp.Net issue applies to me.

What do you think? Any ideas on whats going on?
 
Hi,

I have an Imports statement bringing in System.IO

snippet
<code>
Dim fw As StreamWriter
FilePath = "c:\"
fw = New StreamWriter(FilePath, True)

fw.Write("Hello World")

fw.Close()
</code>
 
[FONT=Verdana, Arial, Helvetica][FONT=Verdana, Arial, Helvetica]I was able to find my problem. I was drilling to the path of the file but leaving out the name of the file itself. (SLAP as he hits his forhead with the palm of his hand)

Thanks for your help!
[/FONT][/FONT]
 
Back
Top