How to allow postback with a rewritten URL

A

Alan Silver

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
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,731
Messages
2,569,432
Members
44,832
Latest member
GlennSmall

Latest Threads

Top