Using C# to create ActiveX

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • JUN

    Using C# to create ActiveX

    Hi all,

    I use c# to create ActiveX control, and works under IE browser.

    Now, i add a "Save" procedure for this ActiveX,but in Client
    calling ,it not works.

    the save procedure:

    public Boolean Save(String fileName)
    {
    Boolean result = false;
    try {
    MessageBox.Show ("11111");
    if(!System.IO.F ile.Exists(file Name))
    System.IO.File. Create(fileName );
    MessageBox.Show ("22222");
    }
    catch (Exception e)
    {
    MessageBox.Show (e.Message);
    result = false;
    }
    return result;
    }

    the client (javascript code)
    Object1.Save("c :\\aaa.txt");

    The error message:

    System.Security .Permissions.Fi leIOPermission, mscorlib,Versio n=2.0.0.0
    Culture=neutral PublickKeyToken =b77a5c561934e0 89 Failed.

    I have set this Assembly to FullTrust. but still not works.

    please help...
  • Pavel Minaev

    #2
    Re: Using C# to create ActiveX

    On Sep 18, 7:30 am, JUN <youk...@gmail. comwrote:
      I use c# to create ActiveX control, and works under IE browser.
    First of all, it's not ActiveX; it's a hosted Windows Forms control.
      Now, i add a "Save" procedure for this ActiveX,but in Client
    calling ,it not works.
    >
      the save procedure:
    >
     public Boolean Save(String fileName)
     {
     Boolean result = false;
     try  {
       MessageBox.Show ("11111");
       if(!System.IO.F ile.Exists(file Name))
         System.IO.File. Create(fileName );
       MessageBox.Show ("22222");
     }
     catch (Exception e)
     {
     MessageBox.Show (e.Message);
     result = false;
     }
     return result;
     }
    >
    the client (javascript code)
    Object1.Save("c :\\aaa.txt");
    >
    The error message:
    >
    System.Security .Permissions.Fi leIOPermission, mscorlib,Versio n=2.0.0.0
    Culture=neutral PublickKeyToken =b77a5c561934e0 89 Failed.
    >
    I have set this Assembly to FullTrust. but still not works.
    How did you do that?

    Comment

    Working...