Hi,

I'm trying to download a file from the web onto my desktop via my form. However, I keep getting a 'Access to the path is denied' error whenever I start the download. I'm using Win7 if that changes anything... Here's where the error occurs:

//create a new file stream where we'll be saving the data
                    strLocal = new FileStream(txtPath.Text, FileMode.Create, FileAccess.Write, FileShare.None);

strLocal is a Stream with the stored data of the file I'm downloading.

What does txtPath.Text evaluate to at run time? If you're running as a non-admin and attempt to save to another user's profile path, for example, it will give you that error.

I have a similar error when trying to create a file. My program creates a folder if it doesn't exist but cannot create a file in that folder. There is another component trying to create the file and it gives me this exception.

What can be done??

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.