Request Validation has detected a potentially dangerous in BlogEngine.net
Pochi giorni fa dopo aver aggiunto e provato a testare un’extensions nella piattaforma di BlogEngine.net 2.7 mi sono scontrato con il seguente errore:
“A potentially dangerous Request.Form value was detected from the client (ctl00$cphAdmin$GoogleAsyncAnalytics$trackerID=”<script type=”text/j”).
Description: Request Validation has detected a potentially dangerous client input value, and processing of the request has been aborted. This value may indicate an attempt to compromise the security of your application, such as a cross-site scripting attack. To allow pages to override application request validation settings, set the requestValidationMode attribute in the httpRuntime configuration section to requestValidationMode=”2.0″. Example: <httpRuntime requestValidationMode=”2.0″ />. After setting this value, you can then disable request validation by setting validateRequest=”false” in the Page directive or in the <pages> configuration section. However, it is strongly recommended that your application explicitly check all inputs in this case. For more information, see http://go.microsoft.com/fwlink/?LinkId=153133.
Exception Details: System.Web.HttpRequestValidationException: A potentially dangerous Request.Form value was detected from the client (ctl00$cphAdmin$GoogleAsyncAnalytics$trackerID=”<script type=”text/j”).”
Dopo vari tentativi ho finalmente risolto agendo nel seguente modo:
- Ho aggiunto al file Default.aspx la ValidateRequest impostandola a inizio pagina a false:
<%@ Page ... ValidateRequest="false"%>
- Poichè sto usando .NET 4.0 ho controllato e aggiunto nel file Web.Config nella sezione httpRuntime il requestValidationMode inserendo la seguente riga di codice: <httpRuntime requestValidationMode=”2.0″/>
Spero possa esser d’aiuto a chi ha riscontrato lo stesso errore e non è riuscito a risolverlo.
Se volete seguire i post di www.informarea.it potete iscrivervi al suo feed RSS.
Segui Informarea |