Wrox Programmer Forums
|
BOOK: Beginning ASP.NET 4 : in C# and VB
This is the forum to discuss the Wrox book Beginning ASP.NET 4: in C# and VB by Imar Spaanjaars; ISBN: 9780470502211
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning ASP.NET 4 : in C# and VB section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old July 20th, 2010, 11:36 PM
Registered User
 
Join Date: Jul 2010
Posts: 3
Thanks: 4
Thanked 0 Times in 0 Posts
Default Chapter 9 and 316pages,Request Validation

I setting the ValidateRequest attribute in the @Page directive to False,but it still
throw an exception.
Here is a part of Description:
To allow pages to override application request validation settings,set the requestValidationMode attribute in the httpRuntime configuration section to requestValidationMode="2.0".
 
Old July 21st, 2010, 02:53 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Hi there,

As the error message suggests, you need to add <httpRuntime requestValidationMode="2.0" /> to your web.config, like this:

Code:
 
<system.web>
  ...
  <httpRuntime requestValidationMode="2.0" />
  ...
</system.web>
This puts validation in a 2.0 compatible mode, which makes Request Validation work again.

Hope this helps,

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!

Last edited by Imar; July 21st, 2010 at 03:06 AM..
The Following User Says Thank You to Imar For This Useful Post:
finkle (July 21st, 2010)
 
Old July 21st, 2010, 03:33 AM
Registered User
 
Join Date: Jul 2010
Posts: 3
Thanks: 4
Thanked 0 Times in 0 Posts
Default

Thank you for your reply Imar.
The problem has been solved when i add<httpRuntime equestValidationMode="2.0" /> to web.config.
 
Old July 25th, 2010, 11:09 PM
Registered User
 
Join Date: May 2010
Posts: 4
Thanks: 1
Thanked 0 Times in 0 Posts
Default ValidateRequest problem

is it a bug in .NET 4 ?
 
Old July 26th, 2010, 02:40 AM
Registered User
 
Join Date: Jul 2010
Posts: 3
Thanks: 4
Thanked 0 Times in 0 Posts
Default

Quote:
Originally Posted by sadeghhp View Post
is it a bug in .NET 4 ?
maybe author forgot to write <httpRuntime requestValidationMode="2.0" />
settings in the book or this settings is default in asp.net 4 for security.
 
Old July 26th, 2010, 04:00 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

The need to add the attribute was added to .NET after I sent in my chapter to Wrox, so I wasn't aware of the problem until after the book was released.

And no, it's not a bug in .NET; it's a feature: http://www.asp.net/learn/whitepapers...__Toc256770147

Cheers,

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!
The Following 2 Users Say Thank You to Imar For This Useful Post:
finkle (July 26th, 2010), sadeghhp (July 26th, 2010)





Similar Threads
Thread Thread Starter Forum Replies Last Post
Chapter 9 - Validation question Rushino BOOK: Beginning ASP.NET 4 : in C# and VB 3 April 26th, 2010 03:47 AM
Chapter 20 WebService: My.Request joergUmbricht BOOK: Beginning Visual Basic 2005 ISBN: 978-0-7645-7401-6 0 September 30th, 2007 02:44 AM
Chapter 7, Request.QueryString problem pacoruizuk BOOK: Beginning ASP 3.0 1 May 19th, 2006 12:32 PM
Chapter 15 - Request("Second Try") thunder BOOK: Beginning ASP 3.0 0 December 5th, 2005 01:09 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.