Hi! The following code works but it uses a security demand, which in my application all too often often leads to a SecurityException being thrown. As you can see the code handles this just fine but I'd like to speed it up if possible. Any suggestions on how to improve things would be greatly appreciated!
using System.Security;
using System.Web;
namespace MyProject
{
internal static class TrustHelper
{
public static bool IsHighlyTrusted()
{
try
{
AspNetHostingPermission permission =
new AspNetHostingPermission(
AspNetHostingPermissionLevel.High);
permission.Demand();
return true;
}
catch (SecurityException)
{
return false;
}
}
}
}