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 September 10th, 2010, 11:45 AM
Authorized User
 
Join Date: Apr 2010
Posts: 21
Thanks: 1
Thanked 1 Time in 1 Post
Default Try It Out Page 555

When I click the Save button, I get the Yellow Screen of Death with the message, "A potentially dangerous Request.Form value was detected from the client (ctl00$cpMainContent$SaveButton="<u>S</u>ave")."

The Description part begins, "Request Validation has detected a potentially dangerous client input value,..."

How do I solve this issue?

Also, the actual text on the button is literally <u>S</u>ave rather than Save with the S underlined. All the Labels' underlined letters appear and work correctly.

Jim
 
Old September 10th, 2010, 02:26 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Hi Jim,

Take a look at page 316 - Understanding Request Validation. You've run into a feature of ASP.NET that protects you from injection attacks. The button's value is submitted with the form, so ASP.NET thinks you're injecting script into the request. Labels are not submitted, so they cause no problem.

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!
 
Old September 10th, 2010, 03:09 PM
Authorized User
 
Join Date: Apr 2010
Posts: 21
Thanks: 1
Thanked 1 Time in 1 Post
Default

So I put ValidateRequest="False" in the Page directive for the HandCoded.aspx and I still get the same error. What have I missed?
 
Old September 10th, 2010, 04:05 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

You also need to set the requestValidationMode to 2.0 in the httpRuntime element under <system.web />, like this:

<httpRuntime requestValidationMode="2.0"/>

By the way, does underlining the letter work for you on a button like this? It doesn't work for me in IE 8.....

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!
 
Old September 11th, 2010, 03:54 PM
Authorized User
 
Join Date: Apr 2010
Posts: 21
Thanks: 1
Thanked 1 Time in 1 Post
Default

That fixes it! Thanks. (That discussion was over 200 pages ago and how soon I forget!)

I use IE 8 and the S on the button does not display properly. It is surrounded by the underline tags. Same result in Safari.
 
Old September 11th, 2010, 04:02 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Exactly. That's what I am seeing as well.

You could try to use a <button> instead if you're using client side controls: http://www.hotscripts.com/forums/htm...accesskey.html

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!





Similar Threads
Thread Thread Starter Forum Replies Last Post
Setting the Master page hoses site... Page 92... richv BOOK: Beginning SharePoint 2010 Development 19 December 30th, 2010 10:21 AM
Page 210:Page object calling a private method from BasePage? aperture8 BOOK: Beginning ASP.NET 4 : in C# and VB 6 August 9th, 2010 07:04 AM
can’t open the page because the server where this page is located isn’t responding m_alsobaai Forum and Wrox.com Feedback 3 July 15th, 2010 06:13 AM
How to print a web page without title, URL, page #, date and time Mattt C# 2 July 17th, 2009 03:02 AM





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