Ok, I have a global page class derived from System.Web.UI.Page, let's call
it BasePage. I have another class derived from that called MemberPage. It
checks the Form collection if it's a post for some "common" fields.
Now, I have an aspx page whose code behind derives from BasePage, and which
sets ValidateRequest=False in the page directive of the aspx. I can post
<script> tags and such with no problems.
However, when I make the code-behind derive from MemberPage, it throws an
exception in ValidateRequest for the Form collection *EVEN THOUGH
VALIDATEREQUEST IS FALSE*.
I don't understand how this could possibly be correct behavior? 8 1848
Max,
This might be annoying, but it's not a bug. The subclassing of BasePage by
MemberPage includes only the code, not the page directive. If you don't
want request validation to be active for any given page, you must specify
this in the page directive for that page.
HTH,
Nicole
"Max Metral" <me******@hotmail.com> wrote in message
news:tI********************@speakeasy.net... Ok, I have a global page class derived from System.Web.UI.Page, let's call it BasePage. I have another class derived from that called MemberPage. It checks the Form collection if it's a post for some "common" fields.
Now, I have an aspx page whose code behind derives from BasePage, and which sets ValidateRequest=False in the page directive of the aspx. I can post <script> tags and such with no problems.
However, when I make the code-behind derive from MemberPage, it throws an exception in ValidateRequest for the Form collection *EVEN THOUGH VALIDATEREQUEST IS FALSE*.
I don't understand how this could possibly be correct behavior?
Makes sense, but the hierarchy is as follows:
System.Web.UI.Page->BasePage->MemberPage->MyASPXCodeBehind->MyASPX
ValidateRequest is False in MyASPX, so it should be false right?
And to be clear, with absolutely NO other changes, this works fine:
System.Web.UI.Page->BasePage->MyASPXCodeBehind->MyASPX
Furthermore, all but the MyASPX are cs classes, and I don't even see a way
to specify the ValidateRequest directive for cs files, so I don't see how
MemberPage could be doing it.
"Nicole Calinoiu" <ni*****@somewhere.net> wrote in message
news:ub*************@tk2msftngp13.phx.gbl... Max,
This might be annoying, but it's not a bug. The subclassing of BasePage by MemberPage includes only the code, not the page directive. If you don't want request validation to be active for any given page, you must specify this in the page directive for that page.
HTH, Nicole "Max Metral" <me******@hotmail.com> wrote in message news:tI********************@speakeasy.net... Ok, I have a global page class derived from System.Web.UI.Page, let's call it BasePage. I have another class derived from that called MemberPage. It checks the Form collection if it's a post for some "common" fields.
Now, I have an aspx page whose code behind derives from BasePage, and which sets ValidateRequest=False in the page directive of the aspx. I can post <script> tags and such with no problems.
However, when I make the code-behind derive from MemberPage, it throws an exception in ValidateRequest for the Form collection *EVEN THOUGH VALIDATEREQUEST IS FALSE*.
I don't understand how this could possibly be correct behavior?
Hi Max,
From your description, when you make your aspx page's codebehind page
class dervied from a two level
custom base page class(indirectly derived from System.Web.UI.Page), the
validateRequest attribute you set in the aspx 's @page diretive not work,
yes?
Based on the page hierarchy you described as below:
==================================
System.Web.UI.Page->BasePage->MemberPage->MyASPXCodeBehind->MyASPX
System.Web.UI.Page->BasePage->MyASPXCodeBehind->MyASPX
====================================
I've also done a simple test on my side , it seems that I can't reproduce
the problem. I uses two very simple page( just derived without add any
custom code), here are the page classes I used to test:
==========================
public class MyBasePage : System.Web.UI.Page
{
public MyBasePage()
{
//
// TODO: Add constructor logic here
//
}
}
public class MyDerivedPage : MyBasePage
{
public MyDerivedPage()
{
}
}
}
=============================
And when I make a aspx page's code behind class derived from either of the
MyBasePage or MyDerivedPage, the validateRequest set in the aspx's @Page
will work. So would you please also have a try so that we can found the
actual cause? Thanks.
Regards,
Steven Cheng
Microsoft Online Support
Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
Get Preview at ASP.NET whidbey http://msdn.microsoft.com/asp.net/whidbey/default.aspx
"Max Metral" <me******@hotmail.com> wrote in message
news:n4********************@speakeasy.net... Makes sense, but the hierarchy is as follows:
System.Web.UI.Page->BasePage->MemberPage->MyASPXCodeBehind->MyASPX
ValidateRequest is False in MyASPX, so it should be false right?
Right. And to be clear, with absolutely NO other changes, this works fine:
System.Web.UI.Page->BasePage->MyASPXCodeBehind->MyASPX
Furthermore, all but the MyASPX are cs classes, and I don't even see a way to specify the ValidateRequest directive for cs files, so I don't see how MemberPage could be doing it.
Like Steven, I can't reproduce the problem. My best guess would be that the
ValidateInput method of the request object is being called either within
MemberPage or in other code (e.g.: code behind the final page, http module,
etc.) that screens for whether the requested resource derives from
MemberPage before running the validation. "Nicole Calinoiu" <ni*****@somewhere.net> wrote in message news:ub*************@tk2msftngp13.phx.gbl... Max,
This might be annoying, but it's not a bug. The subclassing of BasePage by MemberPage includes only the code, not the page directive. If you don't want request validation to be active for any given page, you must specify this in the page directive for that page.
HTH, Nicole "Max Metral" <me******@hotmail.com> wrote in message news:tI********************@speakeasy.net... Ok, I have a global page class derived from System.Web.UI.Page, let's call it BasePage. I have another class derived from that called MemberPage. It checks the Form collection if it's a post for some "common" fields.
Now, I have an aspx page whose code behind derives from BasePage, and which sets ValidateRequest=False in the page directive of the aspx. I can post <script> tags and such with no problems.
However, when I make the code-behind derive from MemberPage, it throws an exception in ValidateRequest for the Form collection *EVEN THOUGH VALIDATEREQUEST IS FALSE*.
I don't understand how this could possibly be correct behavior?
The one difference in your tests is that you need to call something like:
if (Request.Form["foo"] = "bar")
Trace.Write("Yo");
in the page_load or onload of MemberPage. It's during that call that it
seems to call Validate.
"Nicole Calinoiu" <ni*****@somewhere.net> wrote in message
news:OV**************@TK2MSFTNGP10.phx.gbl... "Max Metral" <me******@hotmail.com> wrote in message news:n4********************@speakeasy.net... Makes sense, but the hierarchy is as follows:
System.Web.UI.Page->BasePage->MemberPage->MyASPXCodeBehind->MyASPX
ValidateRequest is False in MyASPX, so it should be false right?
Right.
And to be clear, with absolutely NO other changes, this works fine:
System.Web.UI.Page->BasePage->MyASPXCodeBehind->MyASPX
Furthermore, all but the MyASPX are cs classes, and I don't even see a way to specify the ValidateRequest directive for cs files, so I don't see how MemberPage could be doing it.
Like Steven, I can't reproduce the problem. My best guess would be that the ValidateInput method of the request object is being called either within MemberPage or in other code (e.g.: code behind the final page, http module, etc.) that screens for whether the requested resource derives from MemberPage before running the validation.
"Nicole Calinoiu" <ni*****@somewhere.net> wrote in message news:ub*************@tk2msftngp13.phx.gbl... Max,
This might be annoying, but it's not a bug. The subclassing of BasePage by MemberPage includes only the code, not the page directive. If you don't want request validation to be active for any given page, you must specify this in the page directive for that page.
HTH, Nicole "Max Metral" <me******@hotmail.com> wrote in message news:tI********************@speakeasy.net... Ok, I have a global page class derived from System.Web.UI.Page, let's call it BasePage. I have another class derived from that called MemberPage. It checks the Form collection if it's a post for some "common" fields.
Now, I have an aspx page whose code behind derives from BasePage, and which sets ValidateRequest=False in the page directive of the aspx. I can post <script> tags and such with no problems.
However, when I make the code-behind derive from MemberPage, it throws an exception in ValidateRequest for the Form collection *EVEN THOUGH VALIDATEREQUEST IS FALSE*.
I don't understand how this could possibly be correct behavior?
Still doesn't reproduce here. Are you perhaps using a trace listener that
might be calling ValidateRequest on the request?
"Max Metral" <me******@hotmail.com> wrote in message
news:9u********************@speakeasy.net... The one difference in your tests is that you need to call something like:
if (Request.Form["foo"] = "bar") Trace.Write("Yo");
in the page_load or onload of MemberPage. It's during that call that it seems to call Validate.
"Nicole Calinoiu" <ni*****@somewhere.net> wrote in message news:OV**************@TK2MSFTNGP10.phx.gbl... "Max Metral" <me******@hotmail.com> wrote in message news:n4********************@speakeasy.net... Makes sense, but the hierarchy is as follows:
System.Web.UI.Page->BasePage->MemberPage->MyASPXCodeBehind->MyASPX
ValidateRequest is False in MyASPX, so it should be false right?
Right.
And to be clear, with absolutely NO other changes, this works fine:
System.Web.UI.Page->BasePage->MyASPXCodeBehind->MyASPX
Furthermore, all but the MyASPX are cs classes, and I don't even see a way to specify the ValidateRequest directive for cs files, so I don't see how MemberPage could be doing it.
Like Steven, I can't reproduce the problem. My best guess would be that the ValidateInput method of the request object is being called either within MemberPage or in other code (e.g.: code behind the final page, http module, etc.) that screens for whether the requested resource derives from MemberPage before running the validation.
"Nicole Calinoiu" <ni*****@somewhere.net> wrote in message news:ub*************@tk2msftngp13.phx.gbl... Max,
This might be annoying, but it's not a bug. The subclassing of BasePage by MemberPage includes only the code, not the page directive. If you don't want request validation to be active for any given page, you must specify this in the page directive for that page.
HTH, Nicole "Max Metral" <me******@hotmail.com> wrote in message news:tI********************@speakeasy.net... > Ok, I have a global page class derived from System.Web.UI.Page, let's > call it BasePage. I have another class derived from that called > MemberPage. It checks the Form collection if it's a post for some > "common" fields. > > Now, I have an aspx page whose code behind derives from BasePage, and > which sets ValidateRequest=False in the page directive of the aspx. I > can post <script> tags and such with no problems. > > However, when I make the code-behind derive from MemberPage, it throws > an exception in ValidateRequest for the Form collection *EVEN THOUGH > VALIDATEREQUEST IS FALSE*. > > I don't understand how this could possibly be correct behavior? >
I was tracing to the page, is this not allowed?
"Nicole Calinoiu" <ni*****@somewhere.net> wrote in message
news:ec**************@TK2MSFTNGP10.phx.gbl... Still doesn't reproduce here. Are you perhaps using a trace listener that might be calling ValidateRequest on the request? "Max Metral" <me******@hotmail.com> wrote in message news:9u********************@speakeasy.net... The one difference in your tests is that you need to call something like:
if (Request.Form["foo"] = "bar") Trace.Write("Yo");
in the page_load or onload of MemberPage. It's during that call that it seems to call Validate.
"Nicole Calinoiu" <ni*****@somewhere.net> wrote in message news:OV**************@TK2MSFTNGP10.phx.gbl... "Max Metral" <me******@hotmail.com> wrote in message news:n4********************@speakeasy.net... Makes sense, but the hierarchy is as follows:
System.Web.UI.Page->BasePage->MemberPage->MyASPXCodeBehind->MyASPX
ValidateRequest is False in MyASPX, so it should be false right?
Right.
And to be clear, with absolutely NO other changes, this works fine:
System.Web.UI.Page->BasePage->MyASPXCodeBehind->MyASPX
Furthermore, all but the MyASPX are cs classes, and I don't even see a way to specify the ValidateRequest directive for cs files, so I don't see how MemberPage could be doing it.
Like Steven, I can't reproduce the problem. My best guess would be that the ValidateInput method of the request object is being called either within MemberPage or in other code (e.g.: code behind the final page, http module, etc.) that screens for whether the requested resource derives from MemberPage before running the validation.
"Nicole Calinoiu" <ni*****@somewhere.net> wrote in message news:ub*************@tk2msftngp13.phx.gbl... > Max, > > This might be annoying, but it's not a bug. The subclassing of > BasePage by MemberPage includes only the code, not the page directive. > If you don't want request validation to be active for any given page, > you must specify this in the page directive for that page. > > HTH, > Nicole > > > > "Max Metral" <me******@hotmail.com> wrote in message > news:tI********************@speakeasy.net... >> Ok, I have a global page class derived from System.Web.UI.Page, let's >> call it BasePage. I have another class derived from that called >> MemberPage. It checks the Form collection if it's a post for some >> "common" fields. >> >> Now, I have an aspx page whose code behind derives from BasePage, and >> which sets ValidateRequest=False in the page directive of the aspx. >> I can post <script> tags and such with no problems. >> >> However, when I make the code-behind derive from MemberPage, it >> throws an exception in ValidateRequest for the Form collection *EVEN >> THOUGH VALIDATEREQUEST IS FALSE*. >> >> I don't understand how this could possibly be correct behavior? >> > >
Hi Max,
Thanks for the followup. What's has been done in your page tracer? As far
as what we can find now, this is the only possible cause. you can try
removing the tracing to see whether it works.
Regards,
Steven Cheng
Microsoft Online Support
Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
Get Preview at ASP.NET whidbey http://msdn.microsoft.com/asp.net/whidbey/default.aspx This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: mar |
last post by:
Does anybody know what configuration section should i set
to false here. I also tried setting the page directive
to false but that didn't fix it.
Thanks!
mc
A potentially dangerous...
|
by: Shaun Dore |
last post by:
Hi,
I have a web form containing a TextBox that allows users to edit XML files.
When the page is posted, the changes are saved. This worked fine until the
ValidateRequest 'feature' came along in...
|
by: Benny |
last post by:
Hello Experts,
If the contents of a text box containing a html tag like formmated
characters, i.e. <hello>, and if the validateRequest is set to true, it
gives an error when post back: A...
|
by: Ray Williams |
last post by:
I have a specific page that I have chosen to disable the .NET 1.1 validateRequest options by setting the page directive attribute of "validateRequest" from true to false. I manually validate all...
|
by: Tim Zych |
last post by:
I'm trying to stop .Net from validating data entered into a textbox. When I
enter < or > .Net returns an error:
potentially dangerous Request.Form value was detected from the client...
so a...
| |
by: Andy Fish |
last post by:
Hi,
I have one textbox on the form that needs to have ValidateRequest disabled,
but it seems that it can only be enabled/disabled at a page level.
assuming I have to disable it at for the...
|
by: Umut Tezduyar |
last post by:
I couln't find the code begind property on the Page object that
represents the "ValidateRequest" attribute on the @Page element.
There must be some property that the PageParser knows what to do...
|
by: Dave H |
last post by:
If put this into my Web.config. Shouldn't this turn off the ValiateRequest
app wide?
<configuration>
<system.web>
<pages buffer="true" validateRequest="false" />
I pass SQL around to...
|
by: \A_Michigan_User\ |
last post by:
*WITHOUT* using: ValidateRequest="False" for the whole page (or my whole
site)....
How would I trap/detect that a textBox contains some illegal characters?
(I'm using asp.net v1.1 and vb.net)...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
| |
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...
| |