How to determine a IE embedded control be full trusted?

I

idiot

When I call PolicyHierarchy method in the IE embedded usercontrol, the html
page prompt script error message "security error". It seems that there is no
"SecurityException"?

Html page code :
<OBJECT id='Object1' height=100% width=100%
classid='http:Web.MainFrame.dll#Web.MainFrame.UserControlLogin'
VIEWASTEXT VIEWASTEXT>Failed
</OBJECT>
<script language=javascript>
if(Object1.CheckPolicy())
{
....
}
else
{
....
}
</script>

IE embedded winform unsercontrol
Code :
public void CheckPolicy()
{
try
{
IEnumerator levels = System.Security.SecurityManager.PolicyHierarchy();

while (levels.MoveNext())
{
PolicyLevel level = (PolicyLevel)levels.Current;

CodeGroup group = level.RootCodeGroup;

if (level.Label.ToString( ) == "Machine")
{
if (group.MembershipCondition.ToString( ) == "All code")
{
for(int i=0;i<group.Children.Count;i++)
{
CodeGroup subgroup = group.Children as CodeGroup;
if(subgroup.Name=="[PRODUCT NAME]")
return true;
}
}
}
}

return false;
}
catch(Exception e)
{
return false;
}
}
 

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

Members online

Forum statistics

Threads
473,766
Messages
2,569,569
Members
45,042
Latest member
icassiem

Latest Threads

Top