Using C# to create ActiveX

J

JUN

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.File.Exists(fileName))
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.FileIOPermission,mscorlib,Version=2.0.0.0
Culture=neutral PublickKeyToken=b77a5c561934e089 Failed.

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

please help...
 
P

Pavel Minaev

  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.File.Exists(fileName))
     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.FileIOPermission,mscorlib,Version=2.0.0.0
Culture=neutral PublickKeyToken=b77a5c561934e089 Failed.

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

How did you do that?
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top