Exportar (0) Imprimir
Expandir Tudo
Este artigo foi traduzido por máquina. Coloque o ponteiro do mouse sobre as frases do artigo para ver o texto original. Mais informações.
Tradução
Original

AspNetHostingPermission Classe

Controla o acesso permissões em ambientes do ASP.NET hospedado. Esta classe não pode ser herdada.

Namespace:  System.Web
Assembly:  System (em System. dll)

[SerializableAttribute]
public sealed class AspNetHostingPermission : CodeAccessPermission, 
	IUnrestrictedPermission

The AspNetHostingPermission class is used in conjunction with code access security to help protect public types in the System.Web namespaces.Code must be assigned at least the Minimal trust level to access protected ASP.NET classes.

The AspNetHostingPermission class's Level property is set by configuring the appropriate trust level in the trust configuration element.By default, the level attribute of the trust configuration element is set to Full.That is, by default, ASP.NET applications run under the Unrestricted level.When an ASP.NET application domain is created, ASP.NET reads the value specified for the level attribute of the trust configuration element, creates an instance of the AspNetHostingPermission class with the specified Level attribute, and then adds the class to the permission set for the application domain.For more information, see Níveis de confiança ASP.NET e arquivos de diretiva.

It is recommended that you set the level attribute of the trust configuration element to High for sites that are trusted.For sites that are not trusted, such as a Web server that hosts sites that run code from an external customer, it is recommended that you set the level attribute of the trust configuration element to Medium.

The permission sets that are defined by default for the .NET Framework (for example, LocalIntranet, Internet, and so on) do not include the AspNetHostingPermission permission.That is, the AspNetHostingPermission permission is only assigned, by default, to applications that are running under Full trust.

The following code example shows a class protected using the AspNetHostingPermission permission.Code must be running with at least MinimalAspNetHostingPermission permission Level in order to create an instance of the class.

using System;
using System.Web;
using System.Security.Permissions;

[AspNetHostingPermission(SecurityAction.Demand, Level=AspNetHostingPermissionLevel.Medium)]
public class CustomAspNetClass
{

}


Quaisquer membros públicos estático (compartilhados na Visual Basic) desse tipo são Thread seguro. Não há garantia de que qualquer membro de instância seja isento de segmentos.

Contribuições da comunidade

ADICIONAR
Mostrar:
© 2014 Microsoft