Page appears to fail validation even though it has no validation controls

G

Guest

Hi

I have developed a web app with a dozen or so pages, which allows searching for and editing orders by OrderID. There is a search page for entering multiple search criteria. In addition, each page has a nav bar (actually a user control) along the side which also has a textbox for entering an OrderID, allowing simple searches from any page in the app. This navbar search textbox has a button associated with it which is disabled until the user enters a search value, at which point it becomes enabled. The user can either click the button or press Enter (since the button has focus) and the search commences

The problem is that on one of the pages, pressing Enter disables the search button but does not do the search, although you can click the button and the search performs correctly. It is behaving as though there is a validation failure on the page, because the page is never getting posted back to the server, i.e. the button click event handler is not getting called. I have verified that there are in fact no validation controls on the errant page

After setting ValidateRequest to false in the @Page directive, everything worked correctly. However, I do not want to leave that attribute set, due to the security implications

So the questions are
1. Why is the one page behaving this way when none of the other pages are
2. Why does ValidateRequest fix the problem
3. How can I make the page work correctly without setting ValidateRequest

Thanks

Dan Hurwitz
 
T

Teemu Keiski

Hi,

this has nothing to do with validation controls. I don't know why it would
work when ValidateRequest is false (ValidateRequest impacts ASP.NET checking
if malicious HTML inputs like script and such are trying to be injected).
Anyway,pressing Enter in TextBox is known problem, it is IE related. Andy
Smith has written a control to overcome this problem (which is tried to be
fixed in ASp.NEt v2 as well. IIRC).

http://www.metabuilders.com/Tools/DefaultButtons.aspx

--
Teemu Keiski
MCP, Microsoft MVP (ASP.NET), AspInsiders member
ASP.NET Forum Moderator, AspAlliance Columnist
http://blogs.aspadvice.com/joteke


Hi,

I have developed a web app with a dozen or so pages, which allows searching
for and editing orders by OrderID. There is a search page for entering
multiple search criteria. In addition, each page has a nav bar (actually a
user control) along the side which also has a textbox for entering an
OrderID, allowing simple searches from any page in the app. This navbar
search textbox has a button associated with it which is disabled until the
user enters a search value, at which point it becomes enabled. The user can
either click the button or press Enter (since the button has focus) and the
search commences.

The problem is that on one of the pages, pressing Enter disables the search
button but does not do the search, although you can click the button and the
search performs correctly. It is behaving as though there is a validation
failure on the page, because the page is never getting posted back to the
server, i.e. the button click event handler is not getting called. I have
verified that there are in fact no validation controls on the errant page.

After setting ValidateRequest to false in the @Page directive, everything
worked correctly. However, I do not want to leave that attribute set, due
to the security implications.

So the questions are:
1. Why is the one page behaving this way when none of the other pages are?
2. Why does ValidateRequest fix the problem?
3. How can I make the page work correctly without setting ValidateRequest?

Thanks.

Dan Hurwitz
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,482
Members
44,901
Latest member
Noble71S45

Latest Threads

Top