none
Problem to access RRS feed

  • Question

  • Hi,
    I get this error and Stacktrace like

    Error: Access to the path 'C:\dp13' is denied. Stacktrace    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, FileShare share, Int32 bufferSize, FileOptions options, String msgPath, Boolean bFromProxy)
       at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, Boolean useAsync)
       at MS.Internal.IO.Zip.ZipArchive.OpenOnFile(String path, FileMode mode, FileAccess access, FileShare share, Boolean streaming)
       at System.IO.Packaging.ZipPackage..ctor(String path, FileMode mode, FileAccess access, FileShare share, Boolean streaming)
       at System.IO.Packaging.Package.Open(String path, FileMode packageMode, FileAccess packageAccess, FileShare packageShare, Boolean streaming)
       at System.IO.Packaging.Package.Open(String path, FileMode packageMode, FileAccess packageAccess, FileShare packageShare)
       at DocumentFormat.OpenXml.Packaging.OpenXmlPackage.CreateCore(String path)
       at DocumentFormat.OpenXml.Packaging.SpreadsheetDocument.Create(String path, SpreadsheetDocumentType type, Boolean autoSave)
       at DocumentFormat.OpenXml.Packaging.SpreadsheetDocument.Create(String path, SpreadsheetDocumentType type)
       at WindowsFormsApplication2.Form1.CreateSpreadsheetWorkbook(String filepath, String SheetName0) in c:\App\WindowsFormsApplication9_4_0\WindowsFormsApplication2\Form1.cs:line 387
    


    due to last line below. Why?
            public static void CreateSpreadsheetWorkbook(string filepath,string SheetName0)
            {
                try
                {
                    // Create a spreadsheet document by supplying the filepath.
                    // By default, AutoSave = true, Editable = true, and Type = xlsx.
                    SpreadsheetDocument spreadsheetDocument = SpreadsheetDocument.
                        Create(filepath, SpreadsheetDocumentType.Workbook);



    Many Thanks & Best Regards, Hua Min

    Thursday, October 6, 2016 3:18 AM

Answers

  • Hi,

    You need to use the full path with extension: 

    E.g.   CreateSpreadsheetWorkbook(@"C:\test.xlsx"); 

    • Marked as answer by Jackson_1990 Thursday, October 6, 2016 7:25 AM
    Thursday, October 6, 2016 7:17 AM
    Moderator

All replies

  • Hi,

    Please run VS as administrator if you want create the new files in C Root directory.

    Regards,

    Celeste

    Thursday, October 6, 2016 6:54 AM
    Moderator
  • I try to choose 'Run as Administrator' to start the process and still get
    Error: Access to the path 'C:\dp13' is denied. Stacktrace    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, FileShare share, Int32 bufferSize, FileOptions options, String msgPath, Boolean bFromProxy)
       at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, Boolean useAsync)
       at MS.Internal.IO.Zip.ZipArchive.OpenOnFile(String path, FileMode mode, FileAccess access, FileShare share, Boolean streaming)
       at System.IO.Packaging.ZipPackage..ctor(String path, FileMode mode, FileAccess access, FileShare share, Boolean streaming)
       at System.IO.Packaging.Package.Open(String path, FileMode packageMode, FileAccess packageAccess, FileShare packageShare, Boolean streaming)
       at DocumentFormat.OpenXml.Packaging.OpenXmlPackage.CreateCore(String path)
       at DocumentFormat.OpenXml.Packaging.SpreadsheetDocument.Create(String path, SpreadsheetDocumentType type, Boolean autoSave)
       at DocumentFormat.OpenXml.Packaging.SpreadsheetDocument.Create(String path, SpreadsheetDocumentType type)
       at WindowsFormsApplication2.Form1.CreateSpreadsheetWorkbook(String filepath, String SheetName0) in c:\App\WindowsFormsApplication9_4_0\WindowsFormsApplication2\Form1.cs:line 383



    Many Thanks & Best Regards, Hua Min

    Thursday, October 6, 2016 7:05 AM
  • Hi,

    You need to use the full path with extension: 

    E.g.   CreateSpreadsheetWorkbook(@"C:\test.xlsx"); 

    • Marked as answer by Jackson_1990 Thursday, October 6, 2016 7:25 AM
    Thursday, October 6, 2016 7:17 AM
    Moderator