activex控件绕过IE浏览器安全性检查

wangchangming 2010-02-24 05:38:35
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Runtime.InteropServices;

namespace TLP
{
[Guid("46E2B1CE-6031-4d7e-B52C-390316CEA933")]
public partial class UserControl1 : UserControl, IObjectSafety
{
public UserControl1()
{
InitializeComponent();
}

public void ShowMessage(string msg)
{
if (msg != null)
{
MessageBox.Show(msg);
}
else
{
MessageBox.Show("对象为空!");
}
}

public void GetInterfacceSafyOptions(Int32 riid, out Int32 pdwSupportedOptions, out Int32 pdwEnabledOptions)
{
// TODO: 添加GetInterfacceSafyOptions 实现
pdwSupportedOptions = 1;
pdwEnabledOptions = 2;
}

public void SetInterfaceSafetyOptions(Int32 riid, Int32 dwOptionsSetMask, Int32 dwEnabledOptions)
{
// TODO: 添加SetInterfaceSafetyOptions 实现
}

}

[Guid("5BBB3CCC-90F6-4eaf-9A1E-AAB1D06D0D32"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
public interface IObjectSafety
{

void GetInterfacceSafyOptions(System.Int32 riid, out System.Int32 pdwSupportedOptions, out System.Int32 pdwEnabledOptions);
void SetInterfaceSafetyOptions(System.Int32 riid, System.Int32 dwOptionsSetMask, System.Int32 dwEnabledOptions);
}

}
添加并实现了IObjectSafety接口
<form id="form1" runat="server">
<div>
<object id="TLP1" codebase="setup.exe" classid="clsid:46E2B1CE-6031-4D7E-B52C-390316CEA933">
</object>

<br />
<input id="Button1" type="button" value="button" onclick='TLP1.ShowMessage("Hello World!!")' /></div>
</form>
但还是提示不是安全的Activex控件.
...全文
121 回复 打赏 收藏 转发到动态 举报
写回复
用AI写文章
回复
切换为时间正序
请发表友善的回复…
发表回复

110,536

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧