<link type="text/css" rel="stylesheet" href="http://wevertonsousa.com.br/blog/wp-content/plugins/ajax-comment-posting/acp.css" /><?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Weverton Sousa &#187; Dúvida</title>
	<atom:link href="http://wevertonsousa.com.br/blog/index.php/tag/duvida/feed/" rel="self" type="application/rss+xml" />
	<link>http://wevertonsousa.com.br/blog</link>
	<description>O mundo da tecnologia, por Weverton Sousa !</description>
	<lastBuildDate>Wed, 19 May 2010 01:20:53 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>ValidateRequest não funciona no Framework 4.0</title>
		<link>http://wevertonsousa.com.br/blog/index.php/desenvolvimento/validaterequest-nao-funciona-no-framework-4-0/</link>
		<comments>http://wevertonsousa.com.br/blog/index.php/desenvolvimento/validaterequest-nao-funciona-no-framework-4-0/#comments</comments>
		<pubDate>Sun, 24 Jan 2010 03:10:07 +0000</pubDate>
		<dc:creator>Weverton Sousa</dc:creator>
				<category><![CDATA[Desenvolvimento]]></category>
		<category><![CDATA[Dúvida]]></category>
		<category><![CDATA[Framework 4.0]]></category>
		<category><![CDATA[Programação]]></category>
		<category><![CDATA[Tecnologia]]></category>

		<guid isPermaLink="false">http://wevertonsousa.com.br/blog/?p=740</guid>
		<description><![CDATA[<p>Estava aqui programando com o novo framework, e derrepente tento salvar html dentro do banco e ban!<br />
<br/><br />
Apareceu o erro:</p>
<h3><strong><span style="color: #ff6600;"><code>A potentially dangerous Request.Form value was detected from  			the client </code></span></strong></h3>
<p><br/><br />
Aparentemente este erro é normal quando não esta se utilizando ValidateRequest=&#8221;false&#8221; nas diretivas da página, mas após colocar, o mesmo erro apareceu.<br />
<br/><br />
Basicamente o ValidateRequest funciona para que veja a entrada proveniente do navegador para valores perigosos assim evitando a injeção SQL.<br />
<br/><br />
Então pesquisei, pesquisei e pesquisei e nada de achar onde fazer isto funcionar.<br />
<br/><br />
No próprio site da MSDN mostra que o ValidateRequest só é compativel com os frameworks 3.5, 3.0, 2.0.<br />
<br/><br />
O jeito era fuçar, e então que fui ler a página de erro detalhadamente e encontrei a resposta.<br />
<br/><br />
<span style="font-family: Arial,Helvetica,Geneva,SunSans-Regular,sans-serif;"><strong>Description: </strong>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. <strong>To allow pages to override application request validation settings, set requestValidationMode=&#8221;2.0&#8243; in the  configuration section.</strong> After setting this value, you can then disable request validation by setting validateRequest=&#8221;false&#8221; in the Page directive or in the  configuration section&#8230;.</span><br />
<br/><br />
<span style="font-family: Arial,Helvetica,Geneva,SunSans-Regular,sans-serif;">Ou seja para funcionar é só ir até o web.config e a adicionar a seguinte linha dentro de system.web :</span><br />
<br/><br />
<strong>&lt;httpRuntime requestValidationMode=&#8221;2.0&#8243; /&gt;</strong><br />
<br/><br />
<strong>Mas por que ?</strong><br />
<br/><br />
No framework 4, por padrão, o ValidateRequest é habilitada para todo o site, porque ele é ativado antes da fase BeginRequest de uma solicitação HTTP.<br />
<br/><br />
Porém indico que trate o erro de ValidateRequest para que entradas potencialmente inseguros HTTP que podem ser vetores de ataque sejam barradas.<br />
<br/><br />
Para tratar este erro acesse: <strong><a href="http://www.bufaloinfo.com.br/dicas.aspx?cod=862">http://www.bufaloinfo.com.br/dicas.aspx?cod=862</a></strong></p>
]]></description>
		<wfw:commentRss>http://wevertonsousa.com.br/blog/index.php/desenvolvimento/validaterequest-nao-funciona-no-framework-4-0/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
