HttpRuntimeSection.EnableHeaderChecking Propriedade
Definição
Obtém ou define um valor que indica se a verificação de cabeçalho está habilitada.Gets or sets a value that indicates whether the header checking is enabled.
public:
property bool EnableHeaderChecking { bool get(); void set(bool value); };
[System.Configuration.ConfigurationProperty("enableHeaderChecking", DefaultValue=Mono.Cecil.CustomAttributeArgument)]
public bool EnableHeaderChecking { get; set; }
[<System.Configuration.ConfigurationProperty("enableHeaderChecking", DefaultValue=Mono.Cecil.CustomAttributeArgument)>]
member this.EnableHeaderChecking : bool with get, set
Public Property EnableHeaderChecking As Boolean
Valor da propriedade
true se a verificação de cabeçalho estiver habilitada; caso contrário, false.true if the header checking is enabled; otherwise, false. O valor padrão é true.The default value is true.
- Atributos
Exemplos
O exemplo a seguir mostra como usar a EnableHeaderChecking propriedade.The following example shows how to use the EnableHeaderChecking property.
// Get the EnableHeaderChecking property value.
Response.Write("EnableHeaderChecking: " +
configSection.EnableHeaderChecking + "<br>");
// Set the EnableHeaderChecking property value to true.
configSection.EnableHeaderChecking = true;
' Get the EnableHeaderChecking property value.
Response.Write("EnableHeaderChecking: " & _
configSection.EnableHeaderChecking & "<br>")
' Set the EnableHeaderChecking property value to true.
configSection.EnableHeaderChecking = True
Comentários
A finalidade dessa propriedade é habilitar a codificação do retorno de carro e dos caracteres de nova linha \r e \n , que são encontrados nos cabeçalhos de resposta.The purpose of this property is to enable encoding of the carriage return and newline characters, \r and \n, that are found in response headers.
Nos cabeçalhos de resposta de saída, os caracteres que são representados pelos códigos 0x1F e abaixo são codificados e também o caractere 0x7F (excluir caractere).In outbound response headers, the characters that are represented by the codes 0x1F and below are encoded and also the character 0x7F (delete character). A única exceção é que o caractere 0x09 (o caractere de tabulação) não é modificado.The only exception is that the character 0x09 (the tab character) is unmodified.
Essa codificação pode ajudar a evitar ataques de injeção que exploram um aplicativo que ecoa dados não confiáveis contidos no cabeçalho.This encoding can help to avoid injection attacks that exploit an application that echoes untrusted data contained by the header.
Observação
Essa propriedade não se aplica à linha de status em si (código de status e descrição de status), mas deve ser aplicada a outros cabeçalhos.This property does not apply to the status line itself (status code and status description), but should apply to other headers. Embora < httpRuntime > possa ser definido em qualquer nível, essa propriedade só é aplicável no nível do computador e do aplicativo.Although <httpRuntime> can be set at any level, this property is only applicable at the machine and application level.
Quando essa propriedade é true , que é o padrão, os \r \n caracteres ou encontrados em um cabeçalho de resposta são codificados como %0d e %0a .When this property is true, which is the default, the \r or \n characters found in a response header are encoded to %0d and %0a. Isso anula os ataques de injeção de cabeçalho, fazendo com que a parte do material injetada da mesma linha de cabeçalho.This defeats header-injection attacks by making the injected material part of the same header line. Isso pode interromper a resposta, mas não deve abrir vetores de ataque no cliente.This might break the response but should not open attack vectors against the client. A repetição de dados não confiáveis nunca é uma boa ideia em qualquer situação.Echoing back untrusted data is never a good idea in any situation, though.
Importante
As continuaçãos de cabeçalho HTTP dependem de cabeçalhos que abrangem várias linhas e exigem novas linhas nelas.HTTP header continuations rely on headers spanning multiple lines and require new lines in them. Se você precisar usar as continuações de cabeçalho, precisará definir a EnableHeaderChecking propriedade como false .If you need to use header continuations, you need to set the EnableHeaderChecking property to false. Como há um impacto no desempenho do exame de cabeçalhos, se você tiver certeza de que já está fazendo as verificações corretas, desativar esse recurso poderá melhorar o desempenho do seu aplicativo.Because there is a performance impact from looking at headers, if you are certain you are already doing the right checks, turning off this feature can improve the performance of your application. Antes de desabilitar esse recurso, certifique-se de que você já está tomando as precauções corretas nessa área.Before you disable this feature, be sure you are already taking the right precautions in this area.