Fixing Form Action on UrlRewrite

IF you're rewriting URL's, you've probably come across the same problem I had.

When posting back on the page, the real URL is used.. this is a real pain if you're writing a page which uses the RawUrl to serve up relevant content.

I had a good look around the web for a solution. These ranged from creating a custom HtmlForm control to replacing the form tag in the App_Browsers folder.

The following is simple and worked for me.

Place the following code in the Page_Load of the page you're serving up.


Hope this helps.

Author Paul Hayman

Paul is the COO of kwiboo ltd and has more than 20 years IT consultancy experience. He has consulted for a number of blue chip companies and has been exposed to the folowing sectors: Utilities, Telecommunications, Insurance, Media, Investment Banking, Leisure, Legal, CRM, Pharmaceuticals, Interactive Gaming, Mobile Communications, Online Services.

Paul is the COO and co-founder of kwiboo ( and is also the creator of GeekZilla.


Paul said:

Paul, you're a life saver, I've been tearing my hair out going through overly complicated solutions to this problem for the last coupel of hours, Thanks for that golden nugget

27/Jan/2008 00:51 AM

Peter said:

Paul, i love you! this works perfect for me

02/Jul/2008 15:45 PM

Casey Mack said:

Perfect, worked like a charm! Thanks so much!

06/Oct/2008 22:45 PM

Tom Wilson said:

Thank the lords. I love you.

02/Feb/2009 18:37 PM

phayman said:

You're all welcome

02/Feb/2009 19:12 PM

Add Comment


Your comment has been received and will be shown once it passes moderation.