ValidateInput - Compilation Error

P

Patrick Huffer

When I open a certain page, I receive a "Compilation Error" as
follows:

Compiler Error Message: CS0117: 'System.Web.UI.HtmlControls.HtmlForm'
does not
contain a definition for 'ValidateInput'
Source Error:
Line 712: this.EnableViewStateMac = true;
Line 713: this.SmartNavigation = true;
Line 714: this.Request.ValidateInput();
Line 715: }
Line 716:
Source File: c:\WINNT\Microsoft.NET\Framework\v1.1.4322\Temporary
ASP.NET
Files\twrgrp_apps_inspectionsv2\0eeca9c5\cb7e36a7\5uspnrgt.0.cs
Line: 714

This file is autogenerated by ASP.NET - I have no control over it. I
looked up "ValidateInput()" - the documentation says it is only in
version 1.1 of the framework. My application was originally desinged
in 1.0 of the framework - maybe that has something to do with it?
Visual Studio converted it to 1.1 for me when I upgraded. Also, the
web form has a couple embedded user controls - if that affects
anything.

Just looking at this code - it's clearly asking for
REQUEST.ValidateInput() - why does it complain that there is no
HTMLFORM.ValidateInput()? Does anybody have any idea what's going on
here??
 
V

Victor Garcia Aprea [MVP]

Hi Patrick,

That sounds weird. I've looked at this feature extensively[1] and by your
posted code it looks like the parser-generated class is just plain wrong. It
would really help if you could post a very little sample to repro the issue.

[1] http://weblogs.asp.net/vga/archive/2003/05/02/6329.aspx

--
Victor Garcia Aprea
Microsoft MVP | ASP.NET
Looking for insights on ASP.NET? Read my blog:
http://obies.com/vga/blog.aspx
To contact me remove 'NOSPAM'. Please post all questions to the newsgroup
 
P

Patrick Huffer

Victor Garcia Aprea said:
Hi Patrick,

That sounds weird. I've looked at this feature extensively[1] and by your
posted code it looks like the parser-generated class is just plain wrong. It
would really help if you could post a very little sample to repro the issue.

Hi Victor -

Thanks for your reply. I found the cause of the problem - the
reference to "HtmlForm" made me think of the web page's <form> tag -
and it turns out that somehow that tag was given the id "Request". I
don't name my <form>'s - I always suspected that Visual Studio
generates a name for you based on the name of your file - but in this
case the file was called "Results.aspx", so I don't know how it
happened. Anyway I removed the "id=Request" from the <form> tag (and I
also removed "method=post"), and the problem went away. It seems that
somehow the HtmlForm (which is what your <form> tag becomes, right?)
was interpreted as a Request object because it was named "Request"?
Very interesting!
 

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,777
Messages
2,569,604
Members
45,217
Latest member
topweb3twitterchannels

Latest Threads

Top