none
Windows User Controls into IE Security Problem with DLL

    Question

  • Hi, 

    I´m trying to use winform control into a webpage aspx .  

    I  follow the step of this link to do it. http://www.15seconds.com/issue/030610.htm.

    In my case my user control it´s simple button with 1 label. 

    When i click on the button i call a webservice who return me a simple Helloworld : 


    private void button1_Click(object sender, EventArgs e)  
     
    {  
     
        localhost.Service1 serv = new WCLprint.localhost.Service1();  
        lbltest2.Text = serv.HelloWorld();   
     
    }  
     
     
     


    When i load my webpage my control appear but when i click on the button  i´ve an error message : 
    Aplication attempted to perform an operation not allowed by the security policy. to grant this appliocation the required permission, contact your SA or use the .net framework configuration tool.

    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.EnvironmentPermission, 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.Net.CredentialCache.get_DefaultCredentials()
       at System.Web.Services.Protocols.WebClientProtocol.set_UseDefaultCredentials(Boolean value)
       at WCLprint.localhost.Service1.set_UseDefaultCredentials(Boolean value)
       at WCLprint.localhost.Service1..ctor()
       at WCLprint.GetPrinters.button1_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.EnvironmentPermission
    The Zone of the assembly that failed was:
    Trusted


    I check how to register my WCLprint.dll in the .net Framework configuration 2.0 tool  and tried to add in localIntranet_zone, in internet zone to  (http://localhost/WebPrinter/WCLprint.dll) but maybe i forgot other step.

    I did not use caspol.exe  http://msdn.microsoft.com/en-us/library/d197b1f6.aspx .

    Please give me the steps to register windows form control DLL for IE.

    Thanks in advance,

    Antonio.








     





     
    • Moved by jack 321 Thursday, August 21, 2008 3:35 AM off topic (Moved from Visual C# General to Off-Topic Posts (Do Not Post Here))
    Monday, August 18, 2008 11:46 AM

All replies

  •  I make some search and follow  http://support.microsoft.com/kb/839300/en-us (maybe it could help somebody) ,

    And i could register my dll with strong na,e .

    Now when i call the webservices from my assembly i´ve this message .

    System.Security.SecurityException: Request for the permission of type 'System.Security.Permissions.EnvironmentPermission, 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.Net.CredentialCache.get_DefaultCredentials()
       at System.Web.Services.Protocols.WebClientProtocol.set_UseDefaultCredentials(Boolean value)
       at WCLprint.localhost.Service1.set_UseDefaultCredentials(Boolean value)
       at WCLprint.localhost.Service1..ctor()
       at WCLprint.GetPrinters.button1_Click(Object sender, EventArgs e)
    The action that failed was:
    Demand
    The type of the first permission that failed was:
    System.Security.Permissions.EnvironmentPermission


    If you´ve any idea ....


    Antonio

    Tuesday, August 19, 2008 9:59 AM