Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C#
  4. FileIOPermissions

FileIOPermissions

Scheduled Pinned Locked Moved C#
helpdesignsecurityannouncement
7 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • U Offline
    U Offline
    User 1417132
    wrote on last edited by
    #1

    I would like a place holder class btween my Screen Form and Windows Form. So, I create MyBaseForm class that inherits from System.Windows.Forms.Form. Then I create MYScreenForm class that inherits from MyBaseForm. However, at design time, I am not able to see the MyScreenForm. It gives the following error: Request for the permission to type System.Security.Permissions.FileIOPermission, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeytoken=.... failed. Thus, I am not able todesign my screen visually. Note that I can place any controls programmatically and the code compiles and runs. Appreciate any explanations / help

    H 1 Reply Last reply
    0
    • U User 1417132

      I would like a place holder class btween my Screen Form and Windows Form. So, I create MyBaseForm class that inherits from System.Windows.Forms.Form. Then I create MYScreenForm class that inherits from MyBaseForm. However, at design time, I am not able to see the MyScreenForm. It gives the following error: Request for the permission to type System.Security.Permissions.FileIOPermission, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeytoken=.... failed. Thus, I am not able todesign my screen visually. Note that I can place any controls programmatically and the code compiles and runs. Appreciate any explanations / help

      H Offline
      H Offline
      Heath Stewart
      wrote on last edited by
      #2

      From where is your code running? A FileIOPermission is a code access security permission class that is granted, by default, to all code run from your machine. If your code is running from the intranet or Internet, it is granted even fewer permissions. For a good overview of Code Access Security in .NET, read Understanding .NET Code Access Security[^] here on Code Project. This posting is provided "AS IS" with no warranties, and confers no rights. Software Design Engineer Developer Division Customer Product-lifecycle Experience Microsoft [My Articles] [My Blog]

      L 1 Reply Last reply
      0
      • H Heath Stewart

        From where is your code running? A FileIOPermission is a code access security permission class that is granted, by default, to all code run from your machine. If your code is running from the intranet or Internet, it is granted even fewer permissions. For a good overview of Code Access Security in .NET, read Understanding .NET Code Access Security[^] here on Code Project. This posting is provided "AS IS" with no warranties, and confers no rights. Software Design Engineer Developer Division Customer Product-lifecycle Experience Microsoft [My Articles] [My Blog]

        L Offline
        L Offline
        Lost User
        wrote on last edited by
        #3

        The application is not even running! This error occurs at design time in the Visual Studio. Both classes -- MyBaseForm and MyScreenForm -- are in the same project. In the Solution explorer I click on the MyScreenForm (which inherits from MyBaseForm) to view it in design mode in order to add some controls. Instead of showing the form, this error appears. Thanks

        H 1 Reply Last reply
        0
        • L Lost User

          The application is not even running! This error occurs at design time in the Visual Studio. Both classes -- MyBaseForm and MyScreenForm -- are in the same project. In the Solution explorer I click on the MyScreenForm (which inherits from MyBaseForm) to view it in design mode in order to add some controls. Instead of showing the form, this error appears. Thanks

          H Offline
          H Offline
          Heath Stewart
          wrote on last edited by
          #4

          But the code is running, actually. Notice that when you try to create an inheritted form VS.NET will complain if the assembly that contains the would-be parent form is not compiled yet? If your target location for the assembly is on a network share, for example - even if the drive is mapped - you will most like get a SecurityException because the FileIOPermission isn't granted, by default, to anything but FullTrust code which is only given, by default, to the "My Computer" zone. This posting is provided "AS IS" with no warranties, and confers no rights. Software Design Engineer Developer Division Customer Product-lifecycle Experience Microsoft [My Articles] [My Blog]

          U 1 Reply Last reply
          0
          • H Heath Stewart

            But the code is running, actually. Notice that when you try to create an inheritted form VS.NET will complain if the assembly that contains the would-be parent form is not compiled yet? If your target location for the assembly is on a network share, for example - even if the drive is mapped - you will most like get a SecurityException because the FileIOPermission isn't granted, by default, to anything but FullTrust code which is only given, by default, to the "My Computer" zone. This posting is provided "AS IS" with no warranties, and confers no rights. Software Design Engineer Developer Division Customer Product-lifecycle Experience Microsoft [My Articles] [My Blog]

            U Offline
            U Offline
            User 1417132
            wrote on last edited by
            #5

            Thanks Heath, When I wrote "It is not even running" I meant I did not even execute. Yes, it is running. The problem I am referring to occurs at design time - not at run time. Since I am not executing the code, I thought the IO error should not have occured. However, VS IDE probably is trying to execute the MyBaseForm code so as to display the form in design mode. So, this morning I changed the security to FullTrust - for the module that contains MyBaseForm. However, when tried to view MyScreenForm in design mode, it still did not work. Request help. Thanks once again. Snnn

            H 1 Reply Last reply
            0
            • U User 1417132

              Thanks Heath, When I wrote "It is not even running" I meant I did not even execute. Yes, it is running. The problem I am referring to occurs at design time - not at run time. Since I am not executing the code, I thought the IO error should not have occured. However, VS IDE probably is trying to execute the MyBaseForm code so as to display the form in design mode. So, this morning I changed the security to FullTrust - for the module that contains MyBaseForm. However, when tried to view MyScreenForm in design mode, it still did not work. Request help. Thanks once again. Snnn

              H Offline
              H Offline
              Heath Stewart
              wrote on last edited by
              #6

              Again, the code is actually executing in design mode and serializes to a source file. Depending on what yo'ure trying to do an when, Code Access Security can prevent an application from running (it verifies that an application has the necessary minimal permission set) or from performing a certain action while running (if you demand a certain permission). Please read that CAS article I posted in my previous reply. This posting is provided "AS IS" with no warranties, and confers no rights. Software Design Engineer Developer Division Customer Product-lifecycle Experience Microsoft [My Articles] [My Blog]

              U 1 Reply Last reply
              0
              • H Heath Stewart

                Again, the code is actually executing in design mode and serializes to a source file. Depending on what yo'ure trying to do an when, Code Access Security can prevent an application from running (it verifies that an application has the necessary minimal permission set) or from performing a certain action while running (if you demand a certain permission). Please read that CAS article I posted in my previous reply. This posting is provided "AS IS" with no warranties, and confers no rights. Software Design Engineer Developer Division Customer Product-lifecycle Experience Microsoft [My Articles] [My Blog]

                U Offline
                U Offline
                User 1417132
                wrote on last edited by
                #7

                Thanks Heath for your reply. I have gone through the CAS article you had suggested. It is very informative. However, I have to still go through it a couple of times before I can digest. The impression I got is that CAS is for stopping unauthorized user to execute the code. However, the problem I have been facing is at design time. For the problem to be easily understood, I have created a small project. I am attaching a zip file of the project. This project successfully compiles. You can execute the same. But to observe the current problem, do the following: Open the solution in VS 2003. This contains a Test project. This contains three forms - FrmMain, CSIBaseForm, FrmUser. FrmUser inhertis from CSIBaseForm which in turn inherits from System.Windows.Forms.Form. I double click on the FrmUser form to view it in design mode. It does not show. Could you tell me what the problem is and what I should do to overcome it? There does not seem to be a way of attaching the zip file here. I shall send it directly to your e-mail address. Thanks.

                1 Reply Last reply
                0
                Reply
                • Reply as topic
                Log in to reply
                • Oldest to Newest
                • Newest to Oldest
                • Most Votes


                • Login

                • Don't have an account? Register

                • Login or register to search.
                • First post
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • World
                • Users
                • Groups