By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,360 Members | 2,961 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,360 IT Pros & Developers. It's quick & easy.

handling validateRequest=true in code behind. is there a workarou

P: n/a
is there a way to avoid the validateRequest error page in my code behind
file? i can't seem to find a way to handle the error w/o an error code or
exception being thrown...

i am NOT looking for a link that explains what it does and what it doesn't
do OR the pros/cons, as i've already read through many of those. i just want
to know if i can code some sort of exception to catch for it so that the ugly
yellow/white microsoft generic page doesn't pop up.

there is no error code provided so i am assuming that the only way to avoid
this page is setting validateRequest=false and coding my own validation. i
DO want to use this feature though...is there such a way?

thanks all.
Nov 16 '05 #1
Share this Question
Share on Google+
13 Replies


P: n/a
One approach would be to catch the error from the Application_Error
procedure in your Global.asax file. e.g.:

protected void Application_Error(Object sender, EventArgs e)
{
Exception ex = Server.GetLastError();
if (ex is HttpRequestValidationException)
{
// Do one thing.
}
else
{
// Do something else.
}
}

If this isn't a good solution for your purposes, it might help if you could
provide a few details concerning your desired outcome.

HTH,
Nicole

"R Reyes" <RR****@discussions.microsoft.com> wrote in message
news:98**********************************@microsof t.com...
is there a way to avoid the validateRequest error page in my code behind
file? i can't seem to find a way to handle the error w/o an error code or
exception being thrown...

i am NOT looking for a link that explains what it does and what it doesn't
do OR the pros/cons, as i've already read through many of those. i just
want
to know if i can code some sort of exception to catch for it so that the
ugly
yellow/white microsoft generic page doesn't pop up.

there is no error code provided so i am assuming that the only way to
avoid
this page is setting validateRequest=false and coding my own validation.
i
DO want to use this feature though...is there such a way?

thanks all.

Nov 16 '05 #2

P: n/a
HttpRequestValidationException can not be found. I have tried adding
System.Web and System.Runtime.InteropServices;

Any idea what I am missing here? Thanks for your help this seems like it
would fix the problem as soon as I can get past this minor problem.

"Nicole Calinoiu" wrote:
One approach would be to catch the error from the Application_Error
procedure in your Global.asax file. e.g.:

protected void Application_Error(Object sender, EventArgs e)
{
Exception ex = Server.GetLastError();
if (ex is HttpRequestValidationException)
{
// Do one thing.
}
else
{
// Do something else.
}
}

If this isn't a good solution for your purposes, it might help if you could
provide a few details concerning your desired outcome.

HTH,
Nicole

"R Reyes" <RR****@discussions.microsoft.com> wrote in message
news:98**********************************@microsof t.com...
is there a way to avoid the validateRequest error page in my code behind
file? i can't seem to find a way to handle the error w/o an error code or
exception being thrown...

i am NOT looking for a link that explains what it does and what it doesn't
do OR the pros/cons, as i've already read through many of those. i just
want
to know if i can code some sort of exception to catch for it so that the
ugly
yellow/white microsoft generic page doesn't pop up.

there is no error code provided so i am assuming that the only way to
avoid
this page is setting validateRequest=false and coding my own validation.
i
DO want to use this feature though...is there such a way?

thanks all.


Nov 16 '05 #3

P: n/a
It's in the System.Web namespace, in the System.Web.dll assembly, but it was
only introduced in version 1.1 of the .NET Framework. If you're using
version 1.0, you won't see it, but you shouldn't be seeing request
validation exceptions either...
"R Reyes" <RR****@discussions.microsoft.com> wrote in message
news:B5**********************************@microsof t.com...
HttpRequestValidationException can not be found. I have tried adding
System.Web and System.Runtime.InteropServices;

Any idea what I am missing here? Thanks for your help this seems like it
would fix the problem as soon as I can get past this minor problem.

"Nicole Calinoiu" wrote:
One approach would be to catch the error from the Application_Error
procedure in your Global.asax file. e.g.:

protected void Application_Error(Object sender, EventArgs e)
{
Exception ex = Server.GetLastError();
if (ex is HttpRequestValidationException)
{
// Do one thing.
}
else
{
// Do something else.
}
}

If this isn't a good solution for your purposes, it might help if you
could
provide a few details concerning your desired outcome.

HTH,
Nicole

"R Reyes" <RR****@discussions.microsoft.com> wrote in message
news:98**********************************@microsof t.com...
> is there a way to avoid the validateRequest error page in my code
> behind
> file? i can't seem to find a way to handle the error w/o an error code
> or
> exception being thrown...
>
> i am NOT looking for a link that explains what it does and what it
> doesn't
> do OR the pros/cons, as i've already read through many of those. i
> just
> want
> to know if i can code some sort of exception to catch for it so that
> the
> ugly
> yellow/white microsoft generic page doesn't pop up.
>
> there is no error code provided so i am assuming that the only way to
> avoid
> this page is setting validateRequest=false and coding my own
> validation.
> i
> DO want to use this feature though...is there such a way?
>
> thanks all.


Nov 16 '05 #4

P: n/a
Hi Nicole,

Definitely have 1.1 installed and "using System.Web" is at the top of the
Global.asax.cs file. HttpRequestValidationException exception still isn't
found. Am I missing some reference (in the System.Web.dll assembly)? Or am
I referencing something incorrectly? I was assuming the using keyword with
System.Web would take care of the HttpRequestValidationException not being
found.

These are my namespaces:
using System;
using System.Collections;
using System.ComponentModel;
using System.Web;
using System.Web.SessionState;

Code for the app error:
protected void Application_Error(Object sender, EventArgs e)
{
// Here we will catch the HttpRequestValidationException
Exception ex = Server.GetLastError();
if (ex is HttpRequestValidationException) {
// Server.Transfer(some page);
}
}

Thanks for the quick replies.

"Nicole Calinoiu" wrote:
It's in the System.Web namespace, in the System.Web.dll assembly, but it was
only introduced in version 1.1 of the .NET Framework. If you're using
version 1.0, you won't see it, but you shouldn't be seeing request
validation exceptions either...
"R Reyes" <RR****@discussions.microsoft.com> wrote in message
news:B5**********************************@microsof t.com...
HttpRequestValidationException can not be found. I have tried adding
System.Web and System.Runtime.InteropServices;

Any idea what I am missing here? Thanks for your help this seems like it
would fix the problem as soon as I can get past this minor problem.

"Nicole Calinoiu" wrote:
One approach would be to catch the error from the Application_Error
procedure in your Global.asax file. e.g.:

protected void Application_Error(Object sender, EventArgs e)
{
Exception ex = Server.GetLastError();
if (ex is HttpRequestValidationException)
{
// Do one thing.
}
else
{
// Do something else.
}
}

If this isn't a good solution for your purposes, it might help if you
could
provide a few details concerning your desired outcome.

HTH,
Nicole

"R Reyes" <RR****@discussions.microsoft.com> wrote in message
news:98**********************************@microsof t.com...
> is there a way to avoid the validateRequest error page in my code
> behind
> file? i can't seem to find a way to handle the error w/o an error code
> or
> exception being thrown...
>
> i am NOT looking for a link that explains what it does and what it
> doesn't
> do OR the pros/cons, as i've already read through many of those. i
> just
> want
> to know if i can code some sort of exception to catch for it so that
> the
> ugly
> yellow/white microsoft generic page doesn't pop up.
>
> there is no error code provided so i am assuming that the only way to
> avoid
> this page is setting validateRequest=false and coding my own
> validation.
> i
> DO want to use this feature though...is there such a way?
>
> thanks all.


Nov 16 '05 #5

P: n/a
What exactly do you mean by "HttpRequestValidationException exception still
isn't found"? Are you receiving a compile-time error? A runtime error?
Something else entirely?
"R Reyes" <RR****@discussions.microsoft.com> wrote in message
news:28**********************************@microsof t.com...
Hi Nicole,

Definitely have 1.1 installed and "using System.Web" is at the top of the
Global.asax.cs file. HttpRequestValidationException exception still isn't
found. Am I missing some reference (in the System.Web.dll assembly)? Or
am
I referencing something incorrectly? I was assuming the using keyword
with
System.Web would take care of the HttpRequestValidationException not being
found.

These are my namespaces:
using System;
using System.Collections;
using System.ComponentModel;
using System.Web;
using System.Web.SessionState;

Code for the app error:
protected void Application_Error(Object sender, EventArgs e)
{
// Here we will catch the HttpRequestValidationException
Exception ex = Server.GetLastError();
if (ex is HttpRequestValidationException) {
// Server.Transfer(some page);
}
}

Thanks for the quick replies.

"Nicole Calinoiu" wrote:
It's in the System.Web namespace, in the System.Web.dll assembly, but it
was
only introduced in version 1.1 of the .NET Framework. If you're using
version 1.0, you won't see it, but you shouldn't be seeing request
validation exceptions either...
"R Reyes" <RR****@discussions.microsoft.com> wrote in message
news:B5**********************************@microsof t.com...
> HttpRequestValidationException can not be found. I have tried adding
> System.Web and System.Runtime.InteropServices;
>
> Any idea what I am missing here? Thanks for your help this seems like
> it
> would fix the problem as soon as I can get past this minor problem.
>
> "Nicole Calinoiu" wrote:
>
>> One approach would be to catch the error from the Application_Error
>> procedure in your Global.asax file. e.g.:
>>
>> protected void Application_Error(Object sender, EventArgs e)
>> {
>> Exception ex = Server.GetLastError();
>> if (ex is HttpRequestValidationException)
>> {
>> // Do one thing.
>> }
>> else
>> {
>> // Do something else.
>> }
>> }
>>
>> If this isn't a good solution for your purposes, it might help if you
>> could
>> provide a few details concerning your desired outcome.
>>
>> HTH,
>> Nicole
>>
>>
>>
>> "R Reyes" <RR****@discussions.microsoft.com> wrote in message
>> news:98**********************************@microsof t.com...
>> > is there a way to avoid the validateRequest error page in my code
>> > behind
>> > file? i can't seem to find a way to handle the error w/o an error
>> > code
>> > or
>> > exception being thrown...
>> >
>> > i am NOT looking for a link that explains what it does and what it
>> > doesn't
>> > do OR the pros/cons, as i've already read through many of those. i
>> > just
>> > want
>> > to know if i can code some sort of exception to catch for it so that
>> > the
>> > ugly
>> > yellow/white microsoft generic page doesn't pop up.
>> >
>> > there is no error code provided so i am assuming that the only way
>> > to
>> > avoid
>> > this page is setting validateRequest=false and coding my own
>> > validation.
>> > i
>> > DO want to use this feature though...is there such a way?
>> >
>> > thanks all.
>>
>>
>>


Nov 16 '05 #6

P: n/a
The validate request occurs before the OnInit event of the page, so if
you want to do some sort of catch and continue or special case error
handling you'll need to jump through some hoops:
http://blogs.msdn.com/kaevans/archiv...7/07/9791.aspx

--
Scott
http://www.OdeToCode.com/blogs/scott/

On Wed, 3 Nov 2004 10:29:12 -0800, "R Reyes"
<RR****@discussions.microsoft.com> wrote:
HttpRequestValidationException can not be found. I have tried adding
System.Web and System.Runtime.InteropServices;

Any idea what I am missing here? Thanks for your help this seems like it
would fix the problem as soon as I can get past this minor problem.

"Nicole Calinoiu" wrote:
One approach would be to catch the error from the Application_Error
procedure in your Global.asax file. e.g.:

protected void Application_Error(Object sender, EventArgs e)
{
Exception ex = Server.GetLastError();
if (ex is HttpRequestValidationException)
{
// Do one thing.
}
else
{
// Do something else.
}
}

If this isn't a good solution for your purposes, it might help if you could
provide a few details concerning your desired outcome.

HTH,
Nicole

"R Reyes" <RR****@discussions.microsoft.com> wrote in message
news:98**********************************@microsof t.com...
> is there a way to avoid the validateRequest error page in my code behind
> file? i can't seem to find a way to handle the error w/o an error code or
> exception being thrown...
>
> i am NOT looking for a link that explains what it does and what it doesn't
> do OR the pros/cons, as i've already read through many of those. i just
> want
> to know if i can code some sort of exception to catch for it so that the
> ugly
> yellow/white microsoft generic page doesn't pop up.
>
> there is no error code provided so i am assuming that the only way to
> avoid
> this page is setting validateRequest=false and coding my own validation.
> i
> DO want to use this feature though...is there such a way?
>
> thanks all.



Nov 16 '05 #7

P: n/a
Sorry if I was unclear, it's a compile time error. Right now, I have to
comment the line out to get my website working.

When uncommented this error appears:
Global.asax.cs(48): The type or namespace name
'HttpRequestValidationException' could not be found (are you missing a using
directive or an assembly reference?)

As from the last post, I have included System.Web, but it does not seem to
have a definition for HttpRequestValidationException.

"Nicole Calinoiu" wrote:
What exactly do you mean by "HttpRequestValidationException exception still
isn't found"? Are you receiving a compile-time error? A runtime error?
Something else entirely?
"R Reyes" <RR****@discussions.microsoft.com> wrote in message
news:28**********************************@microsof t.com...
Hi Nicole,

Definitely have 1.1 installed and "using System.Web" is at the top of the
Global.asax.cs file. HttpRequestValidationException exception still isn't
found. Am I missing some reference (in the System.Web.dll assembly)? Or
am
I referencing something incorrectly? I was assuming the using keyword
with
System.Web would take care of the HttpRequestValidationException not being
found.

These are my namespaces:
using System;
using System.Collections;
using System.ComponentModel;
using System.Web;
using System.Web.SessionState;

Code for the app error:
protected void Application_Error(Object sender, EventArgs e)
{
// Here we will catch the HttpRequestValidationException
Exception ex = Server.GetLastError();
if (ex is HttpRequestValidationException) {
// Server.Transfer(some page);
}
}

Thanks for the quick replies.

"Nicole Calinoiu" wrote:
It's in the System.Web namespace, in the System.Web.dll assembly, but it
was
only introduced in version 1.1 of the .NET Framework. If you're using
version 1.0, you won't see it, but you shouldn't be seeing request
validation exceptions either...
"R Reyes" <RR****@discussions.microsoft.com> wrote in message
news:B5**********************************@microsof t.com...
> HttpRequestValidationException can not be found. I have tried adding
> System.Web and System.Runtime.InteropServices;
>
> Any idea what I am missing here? Thanks for your help this seems like
> it
> would fix the problem as soon as I can get past this minor problem.
>
> "Nicole Calinoiu" wrote:
>
>> One approach would be to catch the error from the Application_Error
>> procedure in your Global.asax file. e.g.:
>>
>> protected void Application_Error(Object sender, EventArgs e)
>> {
>> Exception ex = Server.GetLastError();
>> if (ex is HttpRequestValidationException)
>> {
>> // Do one thing.
>> }
>> else
>> {
>> // Do something else.
>> }
>> }
>>
>> If this isn't a good solution for your purposes, it might help if you
>> could
>> provide a few details concerning your desired outcome.
>>
>> HTH,
>> Nicole
>>
>>
>>
>> "R Reyes" <RR****@discussions.microsoft.com> wrote in message
>> news:98**********************************@microsof t.com...
>> > is there a way to avoid the validateRequest error page in my code
>> > behind
>> > file? i can't seem to find a way to handle the error w/o an error
>> > code
>> > or
>> > exception being thrown...
>> >
>> > i am NOT looking for a link that explains what it does and what it
>> > doesn't
>> > do OR the pros/cons, as i've already read through many of those. i
>> > just
>> > want
>> > to know if i can code some sort of exception to catch for it so that
>> > the
>> > ugly
>> > yellow/white microsoft generic page doesn't pop up.
>> >
>> > there is no error code provided so i am assuming that the only way
>> > to
>> > avoid
>> > this page is setting validateRequest=false and coding my own
>> > validation.
>> > i
>> > DO want to use this feature though...is there such a way?
>> >
>> > thanks all.
>>
>>
>>


Nov 16 '05 #8

P: n/a
Hmm... It really should work if version 1.1 of the framework is being used.
Do you have any versions other than 1.1 installed on your developement
machine? Are you perhaps using VStudio 2002 to edit the project?

"R Reyes" <RR****@discussions.microsoft.com> wrote in message
news:AB**********************************@microsof t.com...
Sorry if I was unclear, it's a compile time error. Right now, I have to
comment the line out to get my website working.

When uncommented this error appears:
Global.asax.cs(48): The type or namespace name
'HttpRequestValidationException' could not be found (are you missing a
using
directive or an assembly reference?)

As from the last post, I have included System.Web, but it does not seem to
have a definition for HttpRequestValidationException.

"Nicole Calinoiu" wrote:
What exactly do you mean by "HttpRequestValidationException exception
still
isn't found"? Are you receiving a compile-time error? A runtime error?
Something else entirely?
"R Reyes" <RR****@discussions.microsoft.com> wrote in message
news:28**********************************@microsof t.com...
> Hi Nicole,
>
> Definitely have 1.1 installed and "using System.Web" is at the top of
> the
> Global.asax.cs file. HttpRequestValidationException exception still
> isn't
> found. Am I missing some reference (in the System.Web.dll assembly)?
> Or
> am
> I referencing something incorrectly? I was assuming the using keyword
> with
> System.Web would take care of the HttpRequestValidationException not
> being
> found.
>
> These are my namespaces:
> using System;
> using System.Collections;
> using System.ComponentModel;
> using System.Web;
> using System.Web.SessionState;
>
> Code for the app error:
> protected void Application_Error(Object sender, EventArgs e)
> {
> // Here we will catch the HttpRequestValidationException
> Exception ex = Server.GetLastError();
> if (ex is HttpRequestValidationException) {
> // Server.Transfer(some page);
> }
> }
>
> Thanks for the quick replies.
>
> "Nicole Calinoiu" wrote:
>
>> It's in the System.Web namespace, in the System.Web.dll assembly, but
>> it
>> was
>> only introduced in version 1.1 of the .NET Framework. If you're using
>> version 1.0, you won't see it, but you shouldn't be seeing request
>> validation exceptions either...
>>
>>
>> "R Reyes" <RR****@discussions.microsoft.com> wrote in message
>> news:B5**********************************@microsof t.com...
>> > HttpRequestValidationException can not be found. I have tried
>> > adding
>> > System.Web and System.Runtime.InteropServices;
>> >
>> > Any idea what I am missing here? Thanks for your help this seems
>> > like
>> > it
>> > would fix the problem as soon as I can get past this minor problem.
>> >
>> > "Nicole Calinoiu" wrote:
>> >
>> >> One approach would be to catch the error from the Application_Error
>> >> procedure in your Global.asax file. e.g.:
>> >>
>> >> protected void Application_Error(Object sender, EventArgs e)
>> >> {
>> >> Exception ex = Server.GetLastError();
>> >> if (ex is HttpRequestValidationException)
>> >> {
>> >> // Do one thing.
>> >> }
>> >> else
>> >> {
>> >> // Do something else.
>> >> }
>> >> }
>> >>
>> >> If this isn't a good solution for your purposes, it might help if
>> >> you
>> >> could
>> >> provide a few details concerning your desired outcome.
>> >>
>> >> HTH,
>> >> Nicole
>> >>
>> >>
>> >>
>> >> "R Reyes" <RR****@discussions.microsoft.com> wrote in message
>> >> news:98**********************************@microsof t.com...
>> >> > is there a way to avoid the validateRequest error page in my code
>> >> > behind
>> >> > file? i can't seem to find a way to handle the error w/o an
>> >> > error
>> >> > code
>> >> > or
>> >> > exception being thrown...
>> >> >
>> >> > i am NOT looking for a link that explains what it does and what
>> >> > it
>> >> > doesn't
>> >> > do OR the pros/cons, as i've already read through many of those.
>> >> > i
>> >> > just
>> >> > want
>> >> > to know if i can code some sort of exception to catch for it so
>> >> > that
>> >> > the
>> >> > ugly
>> >> > yellow/white microsoft generic page doesn't pop up.
>> >> >
>> >> > there is no error code provided so i am assuming that the only
>> >> > way
>> >> > to
>> >> > avoid
>> >> > this page is setting validateRequest=false and coding my own
>> >> > validation.
>> >> > i
>> >> > DO want to use this feature though...is there such a way?
>> >> >
>> >> > thanks all.
>> >>
>> >>
>> >>
>>
>>
>>


Nov 16 '05 #9

P: n/a
Acutally funny you mentioned that...I am using VS.NET to edit the project,
but in the "About..." section it says "Microsoft Development Environment 2002
Version 7.0.9466". It also says Microsoft .NET Framework 1.0 Version
1.0.3705"

But in the control panel it says that I have Microsoft .NET Framework 1.1
installed. Or maybe that has nothing to do with which version VS.NET and
ASP.NET is using?

What will I need to reconfig?

"Nicole Calinoiu" wrote:
Hmm... It really should work if version 1.1 of the framework is being used.
Do you have any versions other than 1.1 installed on your developement
machine? Are you perhaps using VStudio 2002 to edit the project?

"R Reyes" <RR****@discussions.microsoft.com> wrote in message
news:AB**********************************@microsof t.com...
Sorry if I was unclear, it's a compile time error. Right now, I have to
comment the line out to get my website working.

When uncommented this error appears:
Global.asax.cs(48): The type or namespace name
'HttpRequestValidationException' could not be found (are you missing a
using
directive or an assembly reference?)

As from the last post, I have included System.Web, but it does not seem to
have a definition for HttpRequestValidationException.

"Nicole Calinoiu" wrote:
What exactly do you mean by "HttpRequestValidationException exception
still
isn't found"? Are you receiving a compile-time error? A runtime error?
Something else entirely?
"R Reyes" <RR****@discussions.microsoft.com> wrote in message
news:28**********************************@microsof t.com...
> Hi Nicole,
>
> Definitely have 1.1 installed and "using System.Web" is at the top of
> the
> Global.asax.cs file. HttpRequestValidationException exception still
> isn't
> found. Am I missing some reference (in the System.Web.dll assembly)?
> Or
> am
> I referencing something incorrectly? I was assuming the using keyword
> with
> System.Web would take care of the HttpRequestValidationException not
> being
> found.
>
> These are my namespaces:
> using System;
> using System.Collections;
> using System.ComponentModel;
> using System.Web;
> using System.Web.SessionState;
>
> Code for the app error:
> protected void Application_Error(Object sender, EventArgs e)
> {
> // Here we will catch the HttpRequestValidationException
> Exception ex = Server.GetLastError();
> if (ex is HttpRequestValidationException) {
> // Server.Transfer(some page);
> }
> }
>
> Thanks for the quick replies.
>
> "Nicole Calinoiu" wrote:
>
>> It's in the System.Web namespace, in the System.Web.dll assembly, but
>> it
>> was
>> only introduced in version 1.1 of the .NET Framework. If you're using
>> version 1.0, you won't see it, but you shouldn't be seeing request
>> validation exceptions either...
>>
>>
>> "R Reyes" <RR****@discussions.microsoft.com> wrote in message
>> news:B5**********************************@microsof t.com...
>> > HttpRequestValidationException can not be found. I have tried
>> > adding
>> > System.Web and System.Runtime.InteropServices;
>> >
>> > Any idea what I am missing here? Thanks for your help this seems
>> > like
>> > it
>> > would fix the problem as soon as I can get past this minor problem.
>> >
>> > "Nicole Calinoiu" wrote:
>> >
>> >> One approach would be to catch the error from the Application_Error
>> >> procedure in your Global.asax file. e.g.:
>> >>
>> >> protected void Application_Error(Object sender, EventArgs e)
>> >> {
>> >> Exception ex = Server.GetLastError();
>> >> if (ex is HttpRequestValidationException)
>> >> {
>> >> // Do one thing.
>> >> }
>> >> else
>> >> {
>> >> // Do something else.
>> >> }
>> >> }
>> >>
>> >> If this isn't a good solution for your purposes, it might help if
>> >> you
>> >> could
>> >> provide a few details concerning your desired outcome.
>> >>
>> >> HTH,
>> >> Nicole
>> >>
>> >>
>> >>
>> >> "R Reyes" <RR****@discussions.microsoft.com> wrote in message
>> >> news:98**********************************@microsof t.com...
>> >> > is there a way to avoid the validateRequest error page in my code
>> >> > behind
>> >> > file? i can't seem to find a way to handle the error w/o an
>> >> > error
>> >> > code
>> >> > or
>> >> > exception being thrown...
>> >> >
>> >> > i am NOT looking for a link that explains what it does and what
>> >> > it
>> >> > doesn't
>> >> > do OR the pros/cons, as i've already read through many of those.
>> >> > i
>> >> > just
>> >> > want
>> >> > to know if i can code some sort of exception to catch for it so
>> >> > that
>> >> > the
>> >> > ugly
>> >> > yellow/white microsoft generic page doesn't pop up.
>> >> >
>> >> > there is no error code provided so i am assuming that the only
>> >> > way
>> >> > to
>> >> > avoid
>> >> > this page is setting validateRequest=false and coding my own
>> >> > validation.
>> >> > i
>> >> > DO want to use this feature though...is there such a way?
>> >> >
>> >> > thanks all.
>> >>
>> >>
>> >>
>>
>>
>>


Nov 16 '05 #10

P: n/a
You can have both versions 1.0 and 1.1 of the .NET Framework installed on
the same machine. When both are installed, each web application running on
the machine can be independently configured to point to either version.
However, the VStudio versions map more strictly to the .NET Framework
versions. VStudio 2002 will only compile against framework 1.0, and VStudio
2003 will only compile against framework 1.1. Since you're running VStudio
2002, you will not be able to use it to compile a project that uses 1.1
features.
"R Reyes" <RR****@discussions.microsoft.com> wrote in message
news:0B**********************************@microsof t.com...
Acutally funny you mentioned that...I am using VS.NET to edit the project,
but in the "About..." section it says "Microsoft Development Environment
2002
Version 7.0.9466". It also says Microsoft .NET Framework 1.0 Version
1.0.3705"

But in the control panel it says that I have Microsoft .NET Framework 1.1
installed. Or maybe that has nothing to do with which version VS.NET and
ASP.NET is using?

What will I need to reconfig?

"Nicole Calinoiu" wrote:
Hmm... It really should work if version 1.1 of the framework is being
used.
Do you have any versions other than 1.1 installed on your developement
machine? Are you perhaps using VStudio 2002 to edit the project?

"R Reyes" <RR****@discussions.microsoft.com> wrote in message
news:AB**********************************@microsof t.com...
> Sorry if I was unclear, it's a compile time error. Right now, I have
> to
> comment the line out to get my website working.
>
> When uncommented this error appears:
> Global.asax.cs(48): The type or namespace name
> 'HttpRequestValidationException' could not be found (are you missing a
> using
> directive or an assembly reference?)
>
> As from the last post, I have included System.Web, but it does not seem
> to
> have a definition for HttpRequestValidationException.
>
> "Nicole Calinoiu" wrote:
>
>> What exactly do you mean by "HttpRequestValidationException exception
>> still
>> isn't found"? Are you receiving a compile-time error? A runtime
>> error?
>> Something else entirely?
>>
>>
>> "R Reyes" <RR****@discussions.microsoft.com> wrote in message
>> news:28**********************************@microsof t.com...
>> > Hi Nicole,
>> >
>> > Definitely have 1.1 installed and "using System.Web" is at the top
>> > of
>> > the
>> > Global.asax.cs file. HttpRequestValidationException exception still
>> > isn't
>> > found. Am I missing some reference (in the System.Web.dll
>> > assembly)?
>> > Or
>> > am
>> > I referencing something incorrectly? I was assuming the using
>> > keyword
>> > with
>> > System.Web would take care of the HttpRequestValidationException not
>> > being
>> > found.
>> >
>> > These are my namespaces:
>> > using System;
>> > using System.Collections;
>> > using System.ComponentModel;
>> > using System.Web;
>> > using System.Web.SessionState;
>> >
>> > Code for the app error:
>> > protected void Application_Error(Object sender, EventArgs e)
>> > {
>> > // Here we will catch the HttpRequestValidationException
>> > Exception ex = Server.GetLastError();
>> > if (ex is HttpRequestValidationException) {
>> > // Server.Transfer(some page);
>> > }
>> > }
>> >
>> > Thanks for the quick replies.
>> >
>> > "Nicole Calinoiu" wrote:
>> >
>> >> It's in the System.Web namespace, in the System.Web.dll assembly,
>> >> but
>> >> it
>> >> was
>> >> only introduced in version 1.1 of the .NET Framework. If you're
>> >> using
>> >> version 1.0, you won't see it, but you shouldn't be seeing request
>> >> validation exceptions either...
>> >>
>> >>
>> >> "R Reyes" <RR****@discussions.microsoft.com> wrote in message
>> >> news:B5**********************************@microsof t.com...
>> >> > HttpRequestValidationException can not be found. I have tried
>> >> > adding
>> >> > System.Web and System.Runtime.InteropServices;
>> >> >
>> >> > Any idea what I am missing here? Thanks for your help this seems
>> >> > like
>> >> > it
>> >> > would fix the problem as soon as I can get past this minor
>> >> > problem.
>> >> >
>> >> > "Nicole Calinoiu" wrote:
>> >> >
>> >> >> One approach would be to catch the error from the
>> >> >> Application_Error
>> >> >> procedure in your Global.asax file. e.g.:
>> >> >>
>> >> >> protected void Application_Error(Object sender, EventArgs e)
>> >> >> {
>> >> >> Exception ex = Server.GetLastError();
>> >> >> if (ex is HttpRequestValidationException)
>> >> >> {
>> >> >> // Do one thing.
>> >> >> }
>> >> >> else
>> >> >> {
>> >> >> // Do something else.
>> >> >> }
>> >> >> }
>> >> >>
>> >> >> If this isn't a good solution for your purposes, it might help
>> >> >> if
>> >> >> you
>> >> >> could
>> >> >> provide a few details concerning your desired outcome.
>> >> >>
>> >> >> HTH,
>> >> >> Nicole
>> >> >>
>> >> >>
>> >> >>
>> >> >> "R Reyes" <RR****@discussions.microsoft.com> wrote in message
>> >> >> news:98**********************************@microsof t.com...
>> >> >> > is there a way to avoid the validateRequest error page in my
>> >> >> > code
>> >> >> > behind
>> >> >> > file? i can't seem to find a way to handle the error w/o an
>> >> >> > error
>> >> >> > code
>> >> >> > or
>> >> >> > exception being thrown...
>> >> >> >
>> >> >> > i am NOT looking for a link that explains what it does and
>> >> >> > what
>> >> >> > it
>> >> >> > doesn't
>> >> >> > do OR the pros/cons, as i've already read through many of
>> >> >> > those.
>> >> >> > i
>> >> >> > just
>> >> >> > want
>> >> >> > to know if i can code some sort of exception to catch for it
>> >> >> > so
>> >> >> > that
>> >> >> > the
>> >> >> > ugly
>> >> >> > yellow/white microsoft generic page doesn't pop up.
>> >> >> >
>> >> >> > there is no error code provided so i am assuming that the only
>> >> >> > way
>> >> >> > to
>> >> >> > avoid
>> >> >> > this page is setting validateRequest=false and coding my own
>> >> >> > validation.
>> >> >> > i
>> >> >> > DO want to use this feature though...is there such a way?
>> >> >> >
>> >> >> > thanks all.
>> >> >>
>> >> >>
>> >> >>
>> >>
>> >>
>> >>
>>
>>
>>


Nov 16 '05 #11

P: n/a
So basically what you're saying is I won't be able to handle this
validateRequest error until i get VS.NET 2003 copy on my machine? :(

Oh no...Well, thanks for all your help. I will see if I can find another
work around for this or I might just have to get VS.NET 2003.

"Nicole Calinoiu" wrote:
You can have both versions 1.0 and 1.1 of the .NET Framework installed on
the same machine. When both are installed, each web application running on
the machine can be independently configured to point to either version.
However, the VStudio versions map more strictly to the .NET Framework
versions. VStudio 2002 will only compile against framework 1.0, and VStudio
2003 will only compile against framework 1.1. Since you're running VStudio
2002, you will not be able to use it to compile a project that uses 1.1
features.
"R Reyes" <RR****@discussions.microsoft.com> wrote in message
news:0B**********************************@microsof t.com...
Acutally funny you mentioned that...I am using VS.NET to edit the project,
but in the "About..." section it says "Microsoft Development Environment
2002
Version 7.0.9466". It also says Microsoft .NET Framework 1.0 Version
1.0.3705"

But in the control panel it says that I have Microsoft .NET Framework 1.1
installed. Or maybe that has nothing to do with which version VS.NET and
ASP.NET is using?

What will I need to reconfig?

"Nicole Calinoiu" wrote:
Hmm... It really should work if version 1.1 of the framework is being
used.
Do you have any versions other than 1.1 installed on your developement
machine? Are you perhaps using VStudio 2002 to edit the project?

"R Reyes" <RR****@discussions.microsoft.com> wrote in message
news:AB**********************************@microsof t.com...
> Sorry if I was unclear, it's a compile time error. Right now, I have
> to
> comment the line out to get my website working.
>
> When uncommented this error appears:
> Global.asax.cs(48): The type or namespace name
> 'HttpRequestValidationException' could not be found (are you missing a
> using
> directive or an assembly reference?)
>
> As from the last post, I have included System.Web, but it does not seem
> to
> have a definition for HttpRequestValidationException.
>
> "Nicole Calinoiu" wrote:
>
>> What exactly do you mean by "HttpRequestValidationException exception
>> still
>> isn't found"? Are you receiving a compile-time error? A runtime
>> error?
>> Something else entirely?
>>
>>
>> "R Reyes" <RR****@discussions.microsoft.com> wrote in message
>> news:28**********************************@microsof t.com...
>> > Hi Nicole,
>> >
>> > Definitely have 1.1 installed and "using System.Web" is at the top
>> > of
>> > the
>> > Global.asax.cs file. HttpRequestValidationException exception still
>> > isn't
>> > found. Am I missing some reference (in the System.Web.dll
>> > assembly)?
>> > Or
>> > am
>> > I referencing something incorrectly? I was assuming the using
>> > keyword
>> > with
>> > System.Web would take care of the HttpRequestValidationException not
>> > being
>> > found.
>> >
>> > These are my namespaces:
>> > using System;
>> > using System.Collections;
>> > using System.ComponentModel;
>> > using System.Web;
>> > using System.Web.SessionState;
>> >
>> > Code for the app error:
>> > protected void Application_Error(Object sender, EventArgs e)
>> > {
>> > // Here we will catch the HttpRequestValidationException
>> > Exception ex = Server.GetLastError();
>> > if (ex is HttpRequestValidationException) {
>> > // Server.Transfer(some page);
>> > }
>> > }
>> >
>> > Thanks for the quick replies.
>> >
>> > "Nicole Calinoiu" wrote:
>> >
>> >> It's in the System.Web namespace, in the System.Web.dll assembly,
>> >> but
>> >> it
>> >> was
>> >> only introduced in version 1.1 of the .NET Framework. If you're
>> >> using
>> >> version 1.0, you won't see it, but you shouldn't be seeing request
>> >> validation exceptions either...
>> >>
>> >>
>> >> "R Reyes" <RR****@discussions.microsoft.com> wrote in message
>> >> news:B5**********************************@microsof t.com...
>> >> > HttpRequestValidationException can not be found. I have tried
>> >> > adding
>> >> > System.Web and System.Runtime.InteropServices;
>> >> >
>> >> > Any idea what I am missing here? Thanks for your help this seems
>> >> > like
>> >> > it
>> >> > would fix the problem as soon as I can get past this minor
>> >> > problem.
>> >> >
>> >> > "Nicole Calinoiu" wrote:
>> >> >
>> >> >> One approach would be to catch the error from the
>> >> >> Application_Error
>> >> >> procedure in your Global.asax file. e.g.:
>> >> >>
>> >> >> protected void Application_Error(Object sender, EventArgs e)
>> >> >> {
>> >> >> Exception ex = Server.GetLastError();
>> >> >> if (ex is HttpRequestValidationException)
>> >> >> {
>> >> >> // Do one thing.
>> >> >> }
>> >> >> else
>> >> >> {
>> >> >> // Do something else.
>> >> >> }
>> >> >> }
>> >> >>
>> >> >> If this isn't a good solution for your purposes, it might help
>> >> >> if
>> >> >> you
>> >> >> could
>> >> >> provide a few details concerning your desired outcome.
>> >> >>
>> >> >> HTH,
>> >> >> Nicole
>> >> >>
>> >> >>
>> >> >>
>> >> >> "R Reyes" <RR****@discussions.microsoft.com> wrote in message
>> >> >> news:98**********************************@microsof t.com...
>> >> >> > is there a way to avoid the validateRequest error page in my
>> >> >> > code
>> >> >> > behind
>> >> >> > file? i can't seem to find a way to handle the error w/o an
>> >> >> > error
>> >> >> > code
>> >> >> > or
>> >> >> > exception being thrown...
>> >> >> >
>> >> >> > i am NOT looking for a link that explains what it does and
>> >> >> > what
>> >> >> > it
>> >> >> > doesn't
>> >> >> > do OR the pros/cons, as i've already read through many of
>> >> >> > those.
>> >> >> > i
>> >> >> > just
>> >> >> > want
>> >> >> > to know if i can code some sort of exception to catch for it
>> >> >> > so
>> >> >> > that
>> >> >> > the
>> >> >> > ugly
>> >> >> > yellow/white microsoft generic page doesn't pop up.
>> >> >> >
>> >> >> > there is no error code provided so i am assuming that the only
>> >> >> > way
>> >> >> > to
>> >> >> > avoid
>> >> >> > this page is setting validateRequest=false and coding my own
>> >> >> > validation.
>> >> >> > i
>> >> >> > DO want to use this feature though...is there such a way?
>> >> >> >
>> >> >> > thanks all.
>> >> >>
>> >> >>
>> >> >>
>> >>
>> >>
>> >>
>>
>>
>>


Nov 16 '05 #12

P: n/a
Not necessarily. There are other IDEs (e.g.: WebMatrix,
http://www.asp.net/webmatrix/default...dex=4&tabId=46) that you
might be able to use to compile your application. You also have the option
of using the command-line compiler (csc.exe) distributed with the .NET
Framwork SDK
(http://www.microsoft.com/downloads/d...-a333c6b9181d).
However, if you do plan on developing and maintaining 1.1 applications,
installing an IDE that can handle this properly might be a good idea...
"R Reyes" <RR****@discussions.microsoft.com> wrote in message
news:26**********************************@microsof t.com...
So basically what you're saying is I won't be able to handle this
validateRequest error until i get VS.NET 2003 copy on my machine? :(

Oh no...Well, thanks for all your help. I will see if I can find another
work around for this or I might just have to get VS.NET 2003.

"Nicole Calinoiu" wrote:
You can have both versions 1.0 and 1.1 of the .NET Framework installed on
the same machine. When both are installed, each web application running
on
the machine can be independently configured to point to either version.
However, the VStudio versions map more strictly to the .NET Framework
versions. VStudio 2002 will only compile against framework 1.0, and
VStudio
2003 will only compile against framework 1.1. Since you're running
VStudio
2002, you will not be able to use it to compile a project that uses 1.1
features.
"R Reyes" <RR****@discussions.microsoft.com> wrote in message
news:0B**********************************@microsof t.com...
> Acutally funny you mentioned that...I am using VS.NET to edit the
> project,
> but in the "About..." section it says "Microsoft Development
> Environment
> 2002
> Version 7.0.9466". It also says Microsoft .NET Framework 1.0 Version
> 1.0.3705"
>
> But in the control panel it says that I have Microsoft .NET Framework
> 1.1
> installed. Or maybe that has nothing to do with which version VS.NET
> and
> ASP.NET is using?
>
> What will I need to reconfig?
>
> "Nicole Calinoiu" wrote:
>
>> Hmm... It really should work if version 1.1 of the framework is being
>> used.
>> Do you have any versions other than 1.1 installed on your developement
>> machine? Are you perhaps using VStudio 2002 to edit the project?
>>
>>
>>
>> "R Reyes" <RR****@discussions.microsoft.com> wrote in message
>> news:AB**********************************@microsof t.com...
>> > Sorry if I was unclear, it's a compile time error. Right now, I
>> > have
>> > to
>> > comment the line out to get my website working.
>> >
>> > When uncommented this error appears:
>> > Global.asax.cs(48): The type or namespace name
>> > 'HttpRequestValidationException' could not be found (are you missing
>> > a
>> > using
>> > directive or an assembly reference?)
>> >
>> > As from the last post, I have included System.Web, but it does not
>> > seem
>> > to
>> > have a definition for HttpRequestValidationException.
>> >
>> > "Nicole Calinoiu" wrote:
>> >
>> >> What exactly do you mean by "HttpRequestValidationException
>> >> exception
>> >> still
>> >> isn't found"? Are you receiving a compile-time error? A runtime
>> >> error?
>> >> Something else entirely?
>> >>
>> >>
>> >> "R Reyes" <RR****@discussions.microsoft.com> wrote in message
>> >> news:28**********************************@microsof t.com...
>> >> > Hi Nicole,
>> >> >
>> >> > Definitely have 1.1 installed and "using System.Web" is at the
>> >> > top
>> >> > of
>> >> > the
>> >> > Global.asax.cs file. HttpRequestValidationException exception
>> >> > still
>> >> > isn't
>> >> > found. Am I missing some reference (in the System.Web.dll
>> >> > assembly)?
>> >> > Or
>> >> > am
>> >> > I referencing something incorrectly? I was assuming the using
>> >> > keyword
>> >> > with
>> >> > System.Web would take care of the HttpRequestValidationException
>> >> > not
>> >> > being
>> >> > found.
>> >> >
>> >> > These are my namespaces:
>> >> > using System;
>> >> > using System.Collections;
>> >> > using System.ComponentModel;
>> >> > using System.Web;
>> >> > using System.Web.SessionState;
>> >> >
>> >> > Code for the app error:
>> >> > protected void Application_Error(Object sender, EventArgs e)
>> >> > {
>> >> > // Here we will catch the HttpRequestValidationException
>> >> > Exception ex = Server.GetLastError();
>> >> > if (ex is HttpRequestValidationException) {
>> >> > // Server.Transfer(some page);
>> >> > }
>> >> > }
>> >> >
>> >> > Thanks for the quick replies.
>> >> >
>> >> > "Nicole Calinoiu" wrote:
>> >> >
>> >> >> It's in the System.Web namespace, in the System.Web.dll
>> >> >> assembly,
>> >> >> but
>> >> >> it
>> >> >> was
>> >> >> only introduced in version 1.1 of the .NET Framework. If you're
>> >> >> using
>> >> >> version 1.0, you won't see it, but you shouldn't be seeing
>> >> >> request
>> >> >> validation exceptions either...
>> >> >>
>> >> >>
>> >> >> "R Reyes" <RR****@discussions.microsoft.com> wrote in message
>> >> >> news:B5**********************************@microsof t.com...
>> >> >> > HttpRequestValidationException can not be found. I have tried
>> >> >> > adding
>> >> >> > System.Web and System.Runtime.InteropServices;
>> >> >> >
>> >> >> > Any idea what I am missing here? Thanks for your help this
>> >> >> > seems
>> >> >> > like
>> >> >> > it
>> >> >> > would fix the problem as soon as I can get past this minor
>> >> >> > problem.
>> >> >> >
>> >> >> > "Nicole Calinoiu" wrote:
>> >> >> >
>> >> >> >> One approach would be to catch the error from the
>> >> >> >> Application_Error
>> >> >> >> procedure in your Global.asax file. e.g.:
>> >> >> >>
>> >> >> >> protected void Application_Error(Object sender, EventArgs e)
>> >> >> >> {
>> >> >> >> Exception ex = Server.GetLastError();
>> >> >> >> if (ex is HttpRequestValidationException)
>> >> >> >> {
>> >> >> >> // Do one thing.
>> >> >> >> }
>> >> >> >> else
>> >> >> >> {
>> >> >> >> // Do something else.
>> >> >> >> }
>> >> >> >> }
>> >> >> >>
>> >> >> >> If this isn't a good solution for your purposes, it might
>> >> >> >> help
>> >> >> >> if
>> >> >> >> you
>> >> >> >> could
>> >> >> >> provide a few details concerning your desired outcome.
>> >> >> >>
>> >> >> >> HTH,
>> >> >> >> Nicole
>> >> >> >>
>> >> >> >>
>> >> >> >>
>> >> >> >> "R Reyes" <RR****@discussions.microsoft.com> wrote in message
>> >> >> >> news:98**********************************@microsof t.com...
>> >> >> >> > is there a way to avoid the validateRequest error page in
>> >> >> >> > my
>> >> >> >> > code
>> >> >> >> > behind
>> >> >> >> > file? i can't seem to find a way to handle the error w/o
>> >> >> >> > an
>> >> >> >> > error
>> >> >> >> > code
>> >> >> >> > or
>> >> >> >> > exception being thrown...
>> >> >> >> >
>> >> >> >> > i am NOT looking for a link that explains what it does and
>> >> >> >> > what
>> >> >> >> > it
>> >> >> >> > doesn't
>> >> >> >> > do OR the pros/cons, as i've already read through many of
>> >> >> >> > those.
>> >> >> >> > i
>> >> >> >> > just
>> >> >> >> > want
>> >> >> >> > to know if i can code some sort of exception to catch for
>> >> >> >> > it
>> >> >> >> > so
>> >> >> >> > that
>> >> >> >> > the
>> >> >> >> > ugly
>> >> >> >> > yellow/white microsoft generic page doesn't pop up.
>> >> >> >> >
>> >> >> >> > there is no error code provided so i am assuming that the
>> >> >> >> > only
>> >> >> >> > way
>> >> >> >> > to
>> >> >> >> > avoid
>> >> >> >> > this page is setting validateRequest=false and coding my
>> >> >> >> > own
>> >> >> >> > validation.
>> >> >> >> > i
>> >> >> >> > DO want to use this feature though...is there such a way?
>> >> >> >> >
>> >> >> >> > thanks all.
>> >> >> >>
>> >> >> >>
>> >> >> >>
>> >> >>
>> >> >>
>> >> >>
>> >>
>> >>
>> >>
>>
>>
>>


Nov 16 '05 #13

P: n/a
Just had another thought... If this is your only 1.1 problem, you could
potentially work around it by using only the type name in your code. e.g.:

Exception ex = Server.GetLastError();
if (ex.GetType().FullName == "System.Web.HttpRequestValidationException")
{
...

It's a bit kludgy, but it should compile under VStudio 2002. If you go this
route, you should definitely test whether it subsequently runs as expected
under Framework 1.1.

"R Reyes" <RR****@discussions.microsoft.com> wrote in message
news:26**********************************@microsof t.com...
So basically what you're saying is I won't be able to handle this
validateRequest error until i get VS.NET 2003 copy on my machine? :(

Oh no...Well, thanks for all your help. I will see if I can find another
work around for this or I might just have to get VS.NET 2003.

"Nicole Calinoiu" wrote:
You can have both versions 1.0 and 1.1 of the .NET Framework installed on
the same machine. When both are installed, each web application running
on
the machine can be independently configured to point to either version.
However, the VStudio versions map more strictly to the .NET Framework
versions. VStudio 2002 will only compile against framework 1.0, and
VStudio
2003 will only compile against framework 1.1. Since you're running
VStudio
2002, you will not be able to use it to compile a project that uses 1.1
features.
"R Reyes" <RR****@discussions.microsoft.com> wrote in message
news:0B**********************************@microsof t.com...
> Acutally funny you mentioned that...I am using VS.NET to edit the
> project,
> but in the "About..." section it says "Microsoft Development
> Environment
> 2002
> Version 7.0.9466". It also says Microsoft .NET Framework 1.0 Version
> 1.0.3705"
>
> But in the control panel it says that I have Microsoft .NET Framework
> 1.1
> installed. Or maybe that has nothing to do with which version VS.NET
> and
> ASP.NET is using?
>
> What will I need to reconfig?
>
> "Nicole Calinoiu" wrote:
>
>> Hmm... It really should work if version 1.1 of the framework is being
>> used.
>> Do you have any versions other than 1.1 installed on your developement
>> machine? Are you perhaps using VStudio 2002 to edit the project?
>>
>>
>>
>> "R Reyes" <RR****@discussions.microsoft.com> wrote in message
>> news:AB**********************************@microsof t.com...
>> > Sorry if I was unclear, it's a compile time error. Right now, I
>> > have
>> > to
>> > comment the line out to get my website working.
>> >
>> > When uncommented this error appears:
>> > Global.asax.cs(48): The type or namespace name
>> > 'HttpRequestValidationException' could not be found (are you missing
>> > a
>> > using
>> > directive or an assembly reference?)
>> >
>> > As from the last post, I have included System.Web, but it does not
>> > seem
>> > to
>> > have a definition for HttpRequestValidationException.
>> >
>> > "Nicole Calinoiu" wrote:
>> >
>> >> What exactly do you mean by "HttpRequestValidationException
>> >> exception
>> >> still
>> >> isn't found"? Are you receiving a compile-time error? A runtime
>> >> error?
>> >> Something else entirely?
>> >>
>> >>
>> >> "R Reyes" <RR****@discussions.microsoft.com> wrote in message
>> >> news:28**********************************@microsof t.com...
>> >> > Hi Nicole,
>> >> >
>> >> > Definitely have 1.1 installed and "using System.Web" is at the
>> >> > top
>> >> > of
>> >> > the
>> >> > Global.asax.cs file. HttpRequestValidationException exception
>> >> > still
>> >> > isn't
>> >> > found. Am I missing some reference (in the System.Web.dll
>> >> > assembly)?
>> >> > Or
>> >> > am
>> >> > I referencing something incorrectly? I was assuming the using
>> >> > keyword
>> >> > with
>> >> > System.Web would take care of the HttpRequestValidationException
>> >> > not
>> >> > being
>> >> > found.
>> >> >
>> >> > These are my namespaces:
>> >> > using System;
>> >> > using System.Collections;
>> >> > using System.ComponentModel;
>> >> > using System.Web;
>> >> > using System.Web.SessionState;
>> >> >
>> >> > Code for the app error:
>> >> > protected void Application_Error(Object sender, EventArgs e)
>> >> > {
>> >> > // Here we will catch the HttpRequestValidationException
>> >> > Exception ex = Server.GetLastError();
>> >> > if (ex is HttpRequestValidationException) {
>> >> > // Server.Transfer(some page);
>> >> > }
>> >> > }
>> >> >
>> >> > Thanks for the quick replies.
>> >> >
>> >> > "Nicole Calinoiu" wrote:
>> >> >
>> >> >> It's in the System.Web namespace, in the System.Web.dll
>> >> >> assembly,
>> >> >> but
>> >> >> it
>> >> >> was
>> >> >> only introduced in version 1.1 of the .NET Framework. If you're
>> >> >> using
>> >> >> version 1.0, you won't see it, but you shouldn't be seeing
>> >> >> request
>> >> >> validation exceptions either...
>> >> >>
>> >> >>
>> >> >> "R Reyes" <RR****@discussions.microsoft.com> wrote in message
>> >> >> news:B5**********************************@microsof t.com...
>> >> >> > HttpRequestValidationException can not be found. I have tried
>> >> >> > adding
>> >> >> > System.Web and System.Runtime.InteropServices;
>> >> >> >
>> >> >> > Any idea what I am missing here? Thanks for your help this
>> >> >> > seems
>> >> >> > like
>> >> >> > it
>> >> >> > would fix the problem as soon as I can get past this minor
>> >> >> > problem.
>> >> >> >
>> >> >> > "Nicole Calinoiu" wrote:
>> >> >> >
>> >> >> >> One approach would be to catch the error from the
>> >> >> >> Application_Error
>> >> >> >> procedure in your Global.asax file. e.g.:
>> >> >> >>
>> >> >> >> protected void Application_Error(Object sender, EventArgs e)
>> >> >> >> {
>> >> >> >> Exception ex = Server.GetLastError();
>> >> >> >> if (ex is HttpRequestValidationException)
>> >> >> >> {
>> >> >> >> // Do one thing.
>> >> >> >> }
>> >> >> >> else
>> >> >> >> {
>> >> >> >> // Do something else.
>> >> >> >> }
>> >> >> >> }
>> >> >> >>
>> >> >> >> If this isn't a good solution for your purposes, it might
>> >> >> >> help
>> >> >> >> if
>> >> >> >> you
>> >> >> >> could
>> >> >> >> provide a few details concerning your desired outcome.
>> >> >> >>
>> >> >> >> HTH,
>> >> >> >> Nicole
>> >> >> >>
>> >> >> >>
>> >> >> >>
>> >> >> >> "R Reyes" <RR****@discussions.microsoft.com> wrote in message
>> >> >> >> news:98**********************************@microsof t.com...
>> >> >> >> > is there a way to avoid the validateRequest error page in
>> >> >> >> > my
>> >> >> >> > code
>> >> >> >> > behind
>> >> >> >> > file? i can't seem to find a way to handle the error w/o
>> >> >> >> > an
>> >> >> >> > error
>> >> >> >> > code
>> >> >> >> > or
>> >> >> >> > exception being thrown...
>> >> >> >> >
>> >> >> >> > i am NOT looking for a link that explains what it does and
>> >> >> >> > what
>> >> >> >> > it
>> >> >> >> > doesn't
>> >> >> >> > do OR the pros/cons, as i've already read through many of
>> >> >> >> > those.
>> >> >> >> > i
>> >> >> >> > just
>> >> >> >> > want
>> >> >> >> > to know if i can code some sort of exception to catch for
>> >> >> >> > it
>> >> >> >> > so
>> >> >> >> > that
>> >> >> >> > the
>> >> >> >> > ugly
>> >> >> >> > yellow/white microsoft generic page doesn't pop up.
>> >> >> >> >
>> >> >> >> > there is no error code provided so i am assuming that the
>> >> >> >> > only
>> >> >> >> > way
>> >> >> >> > to
>> >> >> >> > avoid
>> >> >> >> > this page is setting validateRequest=false and coding my
>> >> >> >> > own
>> >> >> >> > validation.
>> >> >> >> > i
>> >> >> >> > DO want to use this feature though...is there such a way?
>> >> >> >> >
>> >> >> >> > thanks all.
>> >> >> >>
>> >> >> >>
>> >> >> >>
>> >> >>
>> >> >>
>> >> >>
>> >>
>> >>
>> >>
>>
>>
>>


Nov 16 '05 #14

This discussion thread is closed

Replies have been disabled for this discussion.