if (!suppressSecurityChecks)
{
+#if !DISABLE_CAS_USE
#pragma warning disable 618
new SecurityPermission(SecurityPermissionFlag.ControlEvidence).Demand();
#pragma warning restore 618
+#endif
}
}
public abstract IPermission Copy ();
+#if MOBILE && DISABLE_CAS_USE
+ [Obsolete ("CAS support is removed by linker", true)]
+#endif
public void Demand ()
{
// note: here we're sure it's a CAS demand
get {
//This check will not allow to use local user credentials at will.
//Hence the username will not be exposed to the network
+#if !DISABLE_CAS_USE
new EnvironmentPermission(EnvironmentPermissionAccess.Read, "USERNAME").Demand();
+#endif
return SystemNetworkCredential.defaultCredential;
}
}
get {
//This check will not allow to use local user credentials at will.
//Hence the username will not be exposed to the network
+#if !DISABLE_CAS_USE
new EnvironmentPermission(EnvironmentPermissionAccess.Read, "USERNAME").Demand();
+#endif
return SystemNetworkCredential.defaultCredential;
}
}
private static void DemandCallback(object state)
{
+#if !DISABLE_CAS_USE
((CodeAccessPermission) state).Demand();
+#endif
}
// This is for checking if a hostname probably refers to this machine without going to DNS.
{
/// Returns objects that describe the network interfaces on the local computer.
public static NetworkInterface[] GetAllNetworkInterfaces(){
+#if !DISABLE_CAS_USE
(new NetworkInformationPermission(NetworkInformationAccess.Read)).Demand();
+#endif
return SystemNetworkInterface.GetNetworkInterfaces();
}