Re: Question about FileDialog Permission

From: Shel Blauman [MSFT] (sheldonb_at_online.microsoft.com)
Date: 12/21/03

  • Next message: WJ: "Re: .NET Framework Configuration Tool ?"
    Date: Sun, 21 Dec 2003 14:28:16 -0800
    
    

    I mispoke about there not being a way to prevent the file dialog from being
    displayed. It's actually easy, the only downside being you will stop all
    windows of that type from being displayed, not just the file dialog windows.
                new UIPermission(UIPermissionWindow.SafeSubWindows).Deny();
                OpenFileDialog(); // This method, that opens an OpenFileDialog,
    will fail.
                CodeAccessPermission.RevertDeny(); // Revert the deny when you
    want to allow dialog boxes to appear again.

    Typically we'll put out a KB for a critical problem pending a fix appearing
    in the next release. We'll also do a KB when we're seeing a lot of queries
    about a topic that needs clarifying. In this case, the bug is a design
    change request, since the file dialog is working as intended, so we didn't
    request a KB. This isn't a frequently asked question, in fact I searched
    our archives and didn't turn up anyone else asking about it. You did exactly
    right querying this group. A good resource other than KB's and discussion
    group archives is http://www.gotdotnet.com/.

    Shel

    -- 
    This posting is provided "AS IS" with no warranties, and confers no rights.
    Use of included script samples are subject to the terms specified at
    http://www.microsoft.com/info/cpyright.htm
    "Humber Consumer" <consumer62000@yahoo.com> wrote in message
    news:5e1334d1.0312201617.5157a5bf@posting.google.com...
    > thanks guys.
    > I appreciate the help. I know that I can't rely on a dialog box to
    > prevent file access. But I really wanted to prevent opening the dialog
    > box. But now I know that there is a bug so I at least know that my
    > understanding was right,
    >
    > By the way is there any place where you guys post all these known
    > issues ( i know this is not a  very critical error but...) so that
    > people like me who are trying to learn and use .NET would refer to
    > that list in case they suspect something wrong.
    >
    > thanks
    >
    >
    > "Shel Blauman [MSFT]" <sheldonb@online.microsoft.com> wrote in message
    news:<OIGs$JyxDHA.560@TK2MSFTNGP11.phx.gbl>...
    > > The primary problem was the demand for FileDialogPermission was only
    > > occuring on the OpenFile Method of OpenFileDialog and SaveFileDialog.
    It's
    > > actually working as documented, but not necessarily as one would expect.
    My
    > > expectations would be for the dialog to not be displayed at all.
    However,
    > > you shouldn't be depending on FileDialogPermission to protect files, you
    > > should be depending on FileIOPermission.  Here's a remark for
    > > FileDialogPermission:
    > >
    > > "This permission is typically used to provide limited access to
    > > user-specified files when FileIOPermission is not granted.".
    > >
    > > Based on the documentation the permission is working as intended.
    > >
    > > The bug that Ivan mentions would prevent the dialog from being displayed
    at
    > > all, which is what one would intuitively expect.  The soonest you could
    > > expect to see that change would be the next release, but that's not
    > > definite.  That won't do you any good right now anyhow, so my suggestion
    is
    > > to depend of FileIOPermission to protect files.  I don't know of any way
    to
    > > prevent the dialog itself from being displayed.
    > >
    > > Shel Blauman
    > > -- 
    > > This posting is provided "AS IS" with no warranties, and confers no
    rights.
    > > Use of included script samples are subject to the terms specified at
    > > http://www.microsoft.com/info/cpyright.htm
    > >
    > >
    > > "Humber Consumer" <consumer62000@yahoo.com> wrote in message
    > > news:5e1334d1.0312171656.7ac5251@posting.google.com...
    > > > I have .NET 1.1 and still have same problem
    > > >
    > > > "Ivan Medvedev [MS]" <ivanmed@online.microsoft.com> wrote in message
    > >  news:<OIyh2pBxDHA.1396@TK2MSFTNGP10.phx.gbl>...
    > > > > Humber -
    > > > > there was a bug in the previous versions of the .NET Framework that
    > > > > prevented the security check for FileDialogPermission in some cases.
    > >  This
    > > > > bug has been identified and is now fixed.
    > > > > --Ivan
    > > > > http://blogs.dotnetthis.com/ivan
    > > > > This message is provided "AS IS" with no warranties, and confers no
    > >  rights.
    > > > >
    > > > >
    > > > > "Humber Consumer" <consumer62000@yahoo.com> wrote in message
    > > > > news:5e1334d1.0312160918.7a764b49@posting.google.com...
    > > > > > I have a doubt about the code groups and permissions .
    > > > > >
    > > > > > I created a C# windows app and inserted file open dialog.
    > > > > >
    > > > > > I open .NET config wizard and created a code groups CG1 underneath
    > > > > > "Runtime Security Policy">User>COde Groups>All Code . I made the
    Hash
    > > > > > as the membership criteria for this group and addded my app's hash
    (
    > > > > > using import).
    > > > > >
    > > > > > I also created a Permission set where I gave all permissions
    except
    > > > > > "File Dialog" . I assigned this permission set to the new code
    group
    > > > > > that I created and also I made the code group exclusive by
    checking
    > > > > > "this policy ..." check box ( first one) on the general tab of
    > > > > > properties of code group.
    > > > > >
    > > > > >
    > > > > > Now when I open my application,I was expecting to get a Security
    > > > > > Permission Policy exception but I did not receive and  error and
    > > > > > application worked fine and was able to open the file open dialog
    box.
    > > > > >
    > > > > > AM I missing something here?
    > > > > >
    > > > > > I will appreciate help/
    

  • Next message: WJ: "Re: .NET Framework Configuration Tool ?"

    Relevant Pages

    • Re: OpenVMS - When downtime is not an option
      ... elevated rights on the system, does sit matter if it is an application ... Clearly, that would be an OS bug - *if* it had been the case in this instance. ... "An attacker who successfully exploited this vulnerability could take complete control of the affected system. ...
      (comp.os.vms)
    • Re: OpenVMS - When downtime is not an option
      ... application bug to provide access to protected data and/or provides ... elevated rights on the system, does sit matter if it is an application ... "An attacker who successfully exploited this vulnerability could take ...
      (comp.os.vms)
    • Re: Bug in CE Web service
      ... I have confirmed this is a bug. ... confers no rights. ... >>John Spaith ... >>Microsoft Corporation ...
      (microsoft.public.windowsce.app.development)
    • Re: Unexpected error number 380 has occurred: Invalid property val
      ... > If it is confirmed to be a bug, any charges for the incident would be ... > give you a relatively clean configuration to work from. ... > John Eikanger ... > This posting is provided “AS IS” with no warranties, and confers no rights. ...
      (microsoft.public.vb.bugs)
    • Re: I want to report the bug in "Windows 2000", this is a bug, I found
      ... are far more users with same bug, I have same bug as you wrote, I'm hoping ... because you saw some spelling errors. ... of the original post or yours, but please do not accuse me of abuse. ... indeed have rights. ...
      (microsoft.public.win2000.general)