473,320 Members | 1,802 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

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

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
13 7548
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
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
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
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
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
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
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
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
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
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
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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: djw | last post by:
c.l.p- I am having trouble understanding how one is supposed to correctly utilize try:...except:...finally: in real code. If I have a block of code like: def foo(): try: ... some code that...
9
by: DFS | last post by:
Anyone written any code to work with the CommandBar object? I have a custom menubar, with 6 buttons, and up to 3 levels of nested menus, such as: File File | Print (that's 2 levels)
1
by: Tom | last post by:
Suppose you have code structure like this: Option Explicit Dim MyVariable As Single Private Sub CallingProcedure() Call CalledProcedure() ....Do This ... End Sub Private Sub...
4
by: SteadySteps | last post by:
Hi I migrated a project which compiles correctly on VC 6.0 to VS 2002. However now all I get several warning that all the statements within catch blocks are "unreachable code". How can I correct...
6
by: C# Learner | last post by:
In the following two code blocks, DoSomethingUseful throws AnException, while neither of the other called methods throw any exceptions. Which of the code blocks is better (in terms of readability,...
3
by: dhussong | last post by:
I'm trying to implement a generic exception handling routine that will write information to a text file at the time the exception occurred. I am using the Microsoft Application Block for Exception...
1
by: Paramveer.Singh | last post by:
Hi all! I was looking into the postgres8.0 code for exception handling, and it seems that the grammer treats an exception condition as opt_lblname. This means that I can pass any arbitrary string...
3
by: jonamukundu | last post by:
Hi everyone out there I have a rather funny problem. Error handling code routines do not seem to work on my laptop. I still get the default error messages when i test. One my desktop the code...
3
by: neha_chhatre | last post by:
hey please help me execute the code on ubuntu in C #include<stdio.h> #include<stdlib.h> int main() { FILE *fp; char ch; float ticktock;
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.