Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8606699
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T03:09:39+00:00 2026-06-12T03:09:39+00:00

The following line is throwing an exception. I have no idea why. using (var

  • 0

The following line is throwing an exception. I have no idea why.

using (var output = new FileStream(sftpFile.Name, FileMode.Create,FileAccess.ReadWrite))

Exception is:

Error: System.UnauthorizedAccessException: Access to the path 'C:\Users\roberth\
Programming_Projects\Common\UI\bin\Debug' is denied.
   at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
   at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, 
Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions 
options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, 
Boolean useLongPath, Boolean checkHost)
   at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access)
   at CWD.Networking.DownloadFromSftp(String hostname, String user, String passw
ord, Int32 port, String localPath, String remotePath, String filename) in c:\Use
rs\roberth\Programming_Projects\Common\Common\Common.cs:line 566

Line 566 is the using statement above.

Can anyone shed some light as to why I may be triggering an error? I have full permissions to the directory, no compilation issues, I can create new files and folders manually in that directory as well.

–Edit–

I tried running VS as administrator as suggested with no resolution.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T03:09:40+00:00Added an answer on June 12, 2026 at 3:09 am

    The UnauthorizedAccessException error message tells you what file it is you’re trying to open:

    C:\Users\roberth\Programming_Projects\Common\UI\bin\Debug
    

    This looks like a directory name: you can’t open a directory as a file.

    You’ve presumably forgotten to append a filename:

    string filename = Path.Combine(sftpFile.Name, "SomeFile.dat");
    using (var output = new FileStream(filename,...)
    {
        ...
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

The following line of code is causing me an Exception using (new INVU.API.CallContextStore()) {
Have a Sql Script file name spCreation.sql with the following contents. CREATE PROCEDURE dbo.usp_select_customers
My code is throwing the above exception on the following line (line 2 of
I am having to support IE7 and the following line is throwing an error
The following line: string cellData = d.XPathSelectElement(cellSelector).Value; Throws an exception stating The XPath expression
The following line printed output as 4 whereas I was expecting 0. printk(KERN_INFO size
I have the following code running in AsyncTask: socket = new Socket(host, Integer.parseInt(port)); In
I have downloaded the following page using wget and saved it in f.html http://www.ebay.com/sch/i.html?_nkw=gruen&_in_kw=1&_ex_kw=sara+quartz+embassy+bob+robert+elephants+adidas&_sacat=See-All-Categories&_okw=gruen&_oexkw=sara+quartz+embassy+bob+robert+elephants+adidas&_adv=1&_udlo=&_udhi=&_LH_Time=1&_ftrt=903&_ftrv=24&_sabdlo=&_sabdhi=&_samilow=&_samihi=&_sadis=200&_fpos=Zip+code&_fsct=&LH_SALE_CURRENCY=0&_sop=12&_dmd=1&_ipg=50
I have the following JPA (2.0.2) entities: Employee @Entity @Table(name = T_EMPLOYEE) public class
I have written the following line of code that reads the data in a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.