Re: How to handle "A potentially dangerous Request.Form value wasdetected from the client"

Discussion in 'ASP .Net' started by ZRat, Jan 5, 2009.

  1. ZRat

    ZRat Guest

    On Jan 1, 11:53 am, Alan Silver <>
    wrote:
    > In article <>, "Alvin
    > Bruney [ASP.NET MVP]" <> writes
    >
    > >Use javascript to encode the input from the control/textbox before
    > >submitting to the server. Be aware that browsers who run with
    > >javascript will circumvent this.

    >
    > Thanks, but that wasn't what I meant.
    >
    > I don't want to allow any HTML in the input. I just want to be able to
    > catch the error and redisplay the page with a message, instead of the
    > default ASP.NET error page (which isn't very user-friendly).
    >
    > Thanks anyway
    >
    > --
    > Alan Silver
    > (anything added below this line is nothing to do with me)


    This is what we use. In the Application_Error event of Global.asax
    we have the following:

    Exception ex = Server.GetLastError();

    if (ex is HttpRequestValidationException)
    {
    Response.Redirect("~/Errors/RequestError.aspx");
    return;
    }

    We found that we were unable to trap the event on the page, but we
    could handle it here.

    Hope this helps
    ZRat, Jan 5, 2009
    #1
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Jay B. Harlow [MVP - Outlook]

    Re: FileDialog window handle

    Jay B. Harlow [MVP - Outlook], Sep 2, 2003, in forum: ASP .Net
    Replies:
    5
    Views:
    3,869
    Mick Doherty
    Sep 3, 2003
  2. Dietrich
    Replies:
    1
    Views:
    636
    Joe Smith
    Jul 22, 2004
  3. Leon
    Replies:
    2
    Views:
    521
  4. =?ISO-8859-1?Q?KLEIN_St=E9phane?=
    Replies:
    3
    Views:
    444
    hanumizzle
    Oct 6, 2006
  5. Larry Bud
    Replies:
    0
    Views:
    402
    Larry Bud
    Jan 6, 2009
Loading...

Share This Page