How to allow postback with a rewritten URL

Discussion in 'ASP .Net' started by Alan Silver, Dec 1, 2005.

  1. Alan Silver

    Alan Silver Guest

    Hello,

    I have a page where I use URL rewriting, so the user sees something
    like...

    http://www.domain.com/item_12.aspx

    but the real URL is...

    http://www.domain.com/product.aspx?productid=12

    I would like to be able to postback to that page, but doing so would
    post back to the underlying URL, ie product.aspx and not to the fake
    URL.

    I tried using a class inherited from the Form class that removed the
    action attribute, causing the page to post back to itself (found this
    somewhere in MSDN ages ago), which worked fine, but I have just
    discovered that this stops validation working, so I don't want to use
    it.

    I tried getting around this by allowing it to post to product.aspx, then
    in Page_Load, getting the querystring variable, building the fake URL
    and then redirecting to that. Trouble is, when I try this, I get the
    following exception...

    "Invalid postback or callback argument. Event validation is enabled
    using <pages enableEventValidation="true"/> in configuration or <%@ Page
    EnableEventValidation="true" %> in a page. For security purposes, this
    feature verifies that arguments to postback or callback events originate
    from the server control that originally rendered them. If the data is
    valid and expected, use the
    ClientScriptManager.RegisterForEventValidation method in order to
    register the postback or callback data for validation."

    I haven't a clue what this means!!

    Anyone able to help? I'm using 2.0 if it helps. TIA

    --
    Alan Silver
    (anything added below this line is nothing to do with me)
    Alan Silver, Dec 1, 2005
    #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. Berthold Höllmann

    Can (should) this be rewritten without exec?

    Berthold Höllmann, Jun 9, 2004, in forum: Python
    Replies:
    1
    Views:
    240
    Terry Reedy
    Jun 9, 2004
  2. Harald Armin  Massa

    reddit.com rewritten in Python

    Harald Armin Massa, Dec 5, 2005, in forum: Python
    Replies:
    2
    Views:
    295
    Jay Parlar
    Dec 5, 2005
  3. Peter Hansen

    Re: reddit.com rewritten in Python

    Peter Hansen, Dec 5, 2005, in forum: Python
    Replies:
    1
    Views:
    308
    BartlebyScrivener
    Dec 11, 2005
  4. Nikos

    Can this be rewritten better?

    Nikos, Apr 29, 2005, in forum: Perl Misc
    Replies:
    17
    Views:
    163
    Nikos
    Apr 30, 2005
  5. garey
    Replies:
    5
    Views:
    137
    Thomas 'PointedEars' Lahn
    Nov 19, 2009
Loading...

Share This Page