System.Security.SecurityException: Request for the permission of type 'System.Security.Permissions.F

Discussion in 'ASP .Net Security' started by Leyla, Aug 14, 2006.

  1. Leyla

    Leyla Guest

    Hi All,
    I have created a simple windows control that had one button and opens
    up FolderBrowserdialog box.
    When I a try to uses this control in my asp.net app, it generates the
    following error:

    "System.Security.SecurityException: Request for the permission of type
    'System.Security.Permissions.FileIOPermission, mscorlib,
    Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'
    failed."

    I have tried to change my IIS settingto Windows Authantication and I
    have add <identity impersonate="true"/>

    Do I need to do anything with the WindowsControl.dll? or what can I do
    to get around this problem.
    Thanks Leyla




    See the end of this message for details on invoking
    just-in-time (JIT) debugging instead of this dialog box.

    ************** Exception Text **************
    System.Security.SecurityException: Request for the permission of type
    'System.Security.Permissions.FileIOPermission, mscorlib,
    Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'
    failed.
    at System.Security.CodeAccessSecurityEngine.Check(Object demand,
    StackCrawlMark& stackMark, Boolean isPermSet)
    at System.Security.CodeAccessPermission.Demand()
    at System.Windows.Forms.FolderBrowserDialog.get_SelectedPath()
    at ShowDirectoryButton.UserControl1.btnShowDir_Click(Object sender,
    EventArgs e)
    at System.Windows.Forms.Control.OnClick(EventArgs e)
    at System.Windows.Forms.Button.OnClick(EventArgs e)
    at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
    at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons
    button, Int32 clicks)
    at System.Windows.Forms.Control.WndProc(Message& m)
    at System.Windows.Forms.ButtonBase.WndProc(Message& m)
    at System.Windows.Forms.Button.WndProc(Message& m)
    at
    System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
    at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message&
    m)
    at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32
    msg, IntPtr wparam, IntPtr lparam)
    The action that failed was:
    Demand
    The type of the first permission that failed was:
    System.Security.Permissions.FileIOPermission
    The Zone of the assembly that failed was:
    Intranet


    ************** Loaded Assemblies **************
    mscorlib
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.42 (RTM.050727-4200)
    CodeBase:
    file:///C:/WINDOWS/Microsoft.NET/Framework/v2.0.50727/mscorlib.dll
    ----------------------------------------
    System
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.42 (RTM.050727-4200)
    CodeBase:
    file:///C:/WINDOWS/assembly/GAC_MSIL/System/2.0.0.0__b77a5c561934e089/System.dll
    ----------------------------------------
    ShowDirectoryButton
    Assembly Version: 1.0.2414.26587
    Win32 Version: n/a
    CodeBase: http://localhost:4496/ShowDirectoryButton.DLL
    ----------------------------------------
    System.Windows.Forms
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.42 (RTM.050727-4200)
    CodeBase:
    file:///C:/WINDOWS/assembly/GAC_MSIL/System.Windows.Forms/2.0.0.0__b77a5c561934e089/System.Windows.Forms.dll
    ----------------------------------------
    System.Drawing
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.42 (RTM.050727-4200)
    CodeBase:
    file:///C:/WINDOWS/assembly/GAC_MSIL/System.Drawing/2.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll
    ----------------------------------------
    Accessibility
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.42 (RTM.050727-4200)
    CodeBase:
    file:///C:/WINDOWS/assembly/GAC_MSIL/Accessibility/2.0.0.0__b03f5f7f11d50a3a/Accessibility.dll
    ----------------------------------------
    Microsoft.mshtml
    Assembly Version: 7.0.3300.0
    Win32 Version: 7.0.3300.0
    CodeBase:
    file:///C:/WINDOWS/assembly/GAC/Microsoft.mshtml/7.0.3300.0__b03f5f7f11d50a3a/Microsoft.mshtml.dll
    ----------------------------------------

    ************** JIT Debugging **************
    To enable just-in-time (JIT) debugging, the .config file for this
    application or computer (machine.config) must have the
    jitDebugging value set in the system.windows.forms section.
    The application must also be compiled with debugging
    enabled.

    For example:

    <configuration>
    <system.windows.forms jitDebugging="true" />
    </configuration>

    When JIT debugging is enabled, any unhandled exception
    will be sent to the JIT debugger registered on the computer
    rather than be handled by this dialog box.
    Leyla, Aug 14, 2006
    #1
    1. Advertising

  2. Hello,

    seems like your website is running in medium trust.

    What I'm wondering about is - where do you expect the windows control to be
    displayed?

    Best regards,
    Henning Krause

    "Leyla" <> wrote in message
    news:...
    > Hi All,
    > I have created a simple windows control that had one button and opens
    > up FolderBrowserdialog box.
    > When I a try to uses this control in my asp.net app, it generates the
    > following error:
    >
    > "System.Security.SecurityException: Request for the permission of type
    > 'System.Security.Permissions.FileIOPermission, mscorlib,
    > Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'
    > failed."
    >
    > I have tried to change my IIS settingto Windows Authantication and I
    > have add <identity impersonate="true"/>
    >
    > Do I need to do anything with the WindowsControl.dll? or what can I do
    > to get around this problem.
    > Thanks Leyla
    >
    >
    >
    >
    > See the end of this message for details on invoking
    > just-in-time (JIT) debugging instead of this dialog box.
    >
    > ************** Exception Text **************
    > System.Security.SecurityException: Request for the permission of type
    > 'System.Security.Permissions.FileIOPermission, mscorlib,
    > Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'
    > failed.
    > at System.Security.CodeAccessSecurityEngine.Check(Object demand,
    > StackCrawlMark& stackMark, Boolean isPermSet)
    > at System.Security.CodeAccessPermission.Demand()
    > at System.Windows.Forms.FolderBrowserDialog.get_SelectedPath()
    > at ShowDirectoryButton.UserControl1.btnShowDir_Click(Object sender,
    > EventArgs e)
    > at System.Windows.Forms.Control.OnClick(EventArgs e)
    > at System.Windows.Forms.Button.OnClick(EventArgs e)
    > at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
    > at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons
    > button, Int32 clicks)
    > at System.Windows.Forms.Control.WndProc(Message& m)
    > at System.Windows.Forms.ButtonBase.WndProc(Message& m)
    > at System.Windows.Forms.Button.WndProc(Message& m)
    > at
    > System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
    > at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message&
    > m)
    > at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32
    > msg, IntPtr wparam, IntPtr lparam)
    > The action that failed was:
    > Demand
    > The type of the first permission that failed was:
    > System.Security.Permissions.FileIOPermission
    > The Zone of the assembly that failed was:
    > Intranet
    >
    >
    > ************** Loaded Assemblies **************
    > mscorlib
    > Assembly Version: 2.0.0.0
    > Win32 Version: 2.0.50727.42 (RTM.050727-4200)
    > CodeBase:
    > file:///C:/WINDOWS/Microsoft.NET/Framework/v2.0.50727/mscorlib.dll
    > ----------------------------------------
    > System
    > Assembly Version: 2.0.0.0
    > Win32 Version: 2.0.50727.42 (RTM.050727-4200)
    > CodeBase:
    > file:///C:/WINDOWS/assembly/GAC_MSIL/System/2.0.0.0__b77a5c561934e089/System.dll
    > ----------------------------------------
    > ShowDirectoryButton
    > Assembly Version: 1.0.2414.26587
    > Win32 Version: n/a
    > CodeBase: http://localhost:4496/ShowDirectoryButton.DLL
    > ----------------------------------------
    > System.Windows.Forms
    > Assembly Version: 2.0.0.0
    > Win32 Version: 2.0.50727.42 (RTM.050727-4200)
    > CodeBase:
    > file:///C:/WINDOWS/assembly/GAC_MSIL/System.Windows.Forms/2.0.0.0__b77a5c561934e089/System.Windows.Forms.dll
    > ----------------------------------------
    > System.Drawing
    > Assembly Version: 2.0.0.0
    > Win32 Version: 2.0.50727.42 (RTM.050727-4200)
    > CodeBase:
    > file:///C:/WINDOWS/assembly/GAC_MSIL/System.Drawing/2.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll
    > ----------------------------------------
    > Accessibility
    > Assembly Version: 2.0.0.0
    > Win32 Version: 2.0.50727.42 (RTM.050727-4200)
    > CodeBase:
    > file:///C:/WINDOWS/assembly/GAC_MSIL/Accessibility/2.0.0.0__b03f5f7f11d50a3a/Accessibility.dll
    > ----------------------------------------
    > Microsoft.mshtml
    > Assembly Version: 7.0.3300.0
    > Win32 Version: 7.0.3300.0
    > CodeBase:
    > file:///C:/WINDOWS/assembly/GAC/Microsoft.mshtml/7.0.3300.0__b03f5f7f11d50a3a/Microsoft.mshtml.dll
    > ----------------------------------------
    >
    > ************** JIT Debugging **************
    > To enable just-in-time (JIT) debugging, the .config file for this
    > application or computer (machine.config) must have the
    > jitDebugging value set in the system.windows.forms section.
    > The application must also be compiled with debugging
    > enabled.
    >
    > For example:
    >
    > <configuration>
    > <system.windows.forms jitDebugging="true" />
    > </configuration>
    >
    > When JIT debugging is enabled, any unhandled exception
    > will be sent to the JIT debugger registered on the computer
    > rather than be handled by this dialog box.
    >
    Henning Krause [MVP - Exchange], Aug 16, 2006
    #2
    1. Advertising

  3. Leyla

    Leyla Guest

    Hi Henning,
    I need my users to be able to pick a directory, so I need the Folder
    browser to open up when they click the button. similar to browse
    dialog box for selectiong files.
    I also have changed the trust level in the web.config, and that has not
    helped eighter. Do I need to add the trust level to the assambly of
    the windows control?
    thank
    Leyla

    Henning Krause [MVP - Exchange] wrote:
    > Hello,
    >
    > seems like your website is running in medium trust.
    >
    > What I'm wondering about is - where do you expect the windows control to be
    > displayed?
    >
    > Best regards,
    > Henning Krause
    >
    > "Leyla" <> wrote in message
    > news:...
    > > Hi All,
    > > I have created a simple windows control that had one button and opens
    > > up FolderBrowserdialog box.
    > > When I a try to uses this control in my asp.net app, it generates the
    > > following error:
    > >
    > > "System.Security.SecurityException: Request for the permission of type
    > > 'System.Security.Permissions.FileIOPermission, mscorlib,
    > > Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'
    > > failed."
    > >
    > > I have tried to change my IIS settingto Windows Authantication and I
    > > have add <identity impersonate="true"/>
    > >
    > > Do I need to do anything with the WindowsControl.dll? or what can I do
    > > to get around this problem.
    > > Thanks Leyla
    > >
    > >
    > >
    > >
    > > See the end of this message for details on invoking
    > > just-in-time (JIT) debugging instead of this dialog box.
    > >
    > > ************** Exception Text **************
    > > System.Security.SecurityException: Request for the permission of type
    > > 'System.Security.Permissions.FileIOPermission, mscorlib,
    > > Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'
    > > failed.
    > > at System.Security.CodeAccessSecurityEngine.Check(Object demand,
    > > StackCrawlMark& stackMark, Boolean isPermSet)
    > > at System.Security.CodeAccessPermission.Demand()
    > > at System.Windows.Forms.FolderBrowserDialog.get_SelectedPath()
    > > at ShowDirectoryButton.UserControl1.btnShowDir_Click(Object sender,
    > > EventArgs e)
    > > at System.Windows.Forms.Control.OnClick(EventArgs e)
    > > at System.Windows.Forms.Button.OnClick(EventArgs e)
    > > at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
    > > at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons
    > > button, Int32 clicks)
    > > at System.Windows.Forms.Control.WndProc(Message& m)
    > > at System.Windows.Forms.ButtonBase.WndProc(Message& m)
    > > at System.Windows.Forms.Button.WndProc(Message& m)
    > > at
    > > System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
    > > at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message&
    > > m)
    > > at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32
    > > msg, IntPtr wparam, IntPtr lparam)
    > > The action that failed was:
    > > Demand
    > > The type of the first permission that failed was:
    > > System.Security.Permissions.FileIOPermission
    > > The Zone of the assembly that failed was:
    > > Intranet
    > >
    > >
    > > ************** Loaded Assemblies **************
    > > mscorlib
    > > Assembly Version: 2.0.0.0
    > > Win32 Version: 2.0.50727.42 (RTM.050727-4200)
    > > CodeBase:
    > > file:///C:/WINDOWS/Microsoft.NET/Framework/v2.0.50727/mscorlib.dll
    > > ----------------------------------------
    > > System
    > > Assembly Version: 2.0.0.0
    > > Win32 Version: 2.0.50727.42 (RTM.050727-4200)
    > > CodeBase:
    > > file:///C:/WINDOWS/assembly/GAC_MSIL/System/2.0.0.0__b77a5c561934e089/System.dll
    > > ----------------------------------------
    > > ShowDirectoryButton
    > > Assembly Version: 1.0.2414.26587
    > > Win32 Version: n/a
    > > CodeBase: http://localhost:4496/ShowDirectoryButton.DLL
    > > ----------------------------------------
    > > System.Windows.Forms
    > > Assembly Version: 2.0.0.0
    > > Win32 Version: 2.0.50727.42 (RTM.050727-4200)
    > > CodeBase:
    > > file:///C:/WINDOWS/assembly/GAC_MSIL/System.Windows.Forms/2.0.0.0__b77a5c561934e089/System.Windows.Forms.dll
    > > ----------------------------------------
    > > System.Drawing
    > > Assembly Version: 2.0.0.0
    > > Win32 Version: 2.0.50727.42 (RTM.050727-4200)
    > > CodeBase:
    > > file:///C:/WINDOWS/assembly/GAC_MSIL/System.Drawing/2.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll
    > > ----------------------------------------
    > > Accessibility
    > > Assembly Version: 2.0.0.0
    > > Win32 Version: 2.0.50727.42 (RTM.050727-4200)
    > > CodeBase:
    > > file:///C:/WINDOWS/assembly/GAC_MSIL/Accessibility/2.0.0.0__b03f5f7f11d50a3a/Accessibility.dll
    > > ----------------------------------------
    > > Microsoft.mshtml
    > > Assembly Version: 7.0.3300.0
    > > Win32 Version: 7.0.3300.0
    > > CodeBase:
    > > file:///C:/WINDOWS/assembly/GAC/Microsoft.mshtml/7.0.3300.0__b03f5f7f11d50a3a/Microsoft.mshtml.dll
    > > ----------------------------------------
    > >
    > > ************** JIT Debugging **************
    > > To enable just-in-time (JIT) debugging, the .config file for this
    > > application or computer (machine.config) must have the
    > > jitDebugging value set in the system.windows.forms section.
    > > The application must also be compiled with debugging
    > > enabled.
    > >
    > > For example:
    > >
    > > <configuration>
    > > <system.windows.forms jitDebugging="true" />
    > > </configuration>
    > >
    > > When JIT debugging is enabled, any unhandled exception
    > > will be sent to the JIT debugger registered on the computer
    > > rather than be handled by this dialog box.
    > >
    Leyla, Aug 17, 2006
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. stephen
    Replies:
    4
    Views:
    4,296
    Nicole Calinoiu
    Aug 9, 2006
  2. Siberwulf
    Replies:
    0
    Views:
    1,628
    Siberwulf
    Oct 6, 2006
  3. Henry Stock

    System.Security.SecurityException: Request

    Henry Stock, Aug 16, 2008, in forum: ASP .Net
    Replies:
    5
    Views:
    706
    Henry Stock
    Aug 17, 2008
  4. Sunetra Urhekar

    System.Security.SecurityException: Request failed

    Sunetra Urhekar, Nov 8, 2004, in forum: ASP .Net Security
    Replies:
    0
    Views:
    116
    Sunetra Urhekar
    Nov 8, 2004
  5. Replies:
    0
    Views:
    312
Loading...

Share This Page