none
UnauthorizedAccessException Not Working

    Question

  • I have to use WCF Service In Vb.Net Application

    My Service is hosted in Windows Server but i have use Access File And Directory From other path.

    I use DirectoryInfo.Create() Method and Catch The UnauthorizedAccessException but if User Don't have Permission on that path

    then UnauthorizedAccessException not Generated. IOException Generate.

    Please Help Me.

    Thursday, February 8, 2018 4:57 PM

Answers

  • Hi Mayur,

    If DirectoryInfo.Create Method (DirectorySecurity) have IOException error, it means that the directory specified by path is read-only or is not empty, so please check the directory is read-only or not. It  may have multiple mistakes, but running to catch the first mistake.

    https://msdn.microsoft.com/en-us/library/w6esbt79(v=vs.110).aspx

    Best Regards,

    Cherry


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    • Marked as answer by Mayur Nakrani Monday, March 26, 2018 9:13 AM
    Friday, February 9, 2018 7:54 AM
    Moderator

All replies

  • Hi Mayur Nakrani,

    Thank you for posting here.

    According to your question is more related to vb, I will move it to Visual Basic forum for suitable support.

    The CLR Forum discuss and ask questions about .NET Framework Base Classes (BCL) such as Collections, I/O, Regigistry, Globalization, Reflection. Also discuss all the other Microsoft libraries that are built on or extend the .NET Framework, including Managed Extensibility Framework (MEF), Charting Controls, CardSpace, Windows Identity Foundation (WIF), Point of Sale (POS), Transactions.

    Best Regards,

    Wendy


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Friday, February 9, 2018 7:11 AM
  • Hi Mayur,

    If DirectoryInfo.Create Method (DirectorySecurity) have IOException error, it means that the directory specified by path is read-only or is not empty, so please check the directory is read-only or not. It  may have multiple mistakes, but running to catch the first mistake.

    https://msdn.microsoft.com/en-us/library/w6esbt79(v=vs.110).aspx

    Best Regards,

    Cherry


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    • Marked as answer by Mayur Nakrani Monday, March 26, 2018 9:13 AM
    Friday, February 9, 2018 7:54 AM
    Moderator