You are not Logged in
Would you like to Login or Register

Today is: Friday, 21 November, 2008
Check this months hot topics

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.

HttpContext.Current.RewritePath(HttpContext.Current.Request.RawUrl);

Hope this helps.

kick it on DotNetKicks.com del.icio.us digg Mister Wong YahooMyWeb Reddit Furl Spurl blogmarks
Paul Hayman Skype
Author : Paul Hayman
Published : Monday, 05 November, 2007

Paul is the COO of kwiboo ltd consultant and has more than a decade of 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 (http://www.kwiboo.com/) and is also the creator of GeekZilla.

Comments

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

January 27, 2008 - 12:51 AM

Peter said:

Paul, i love you! this works perfect for me

July 02, 2008 - 3:45 PM

Casey Mack said:

Perfect, worked like a charm! Thanks so much!

October 06, 2008 - 10:45 PM

Add Comment

Enter your comment below and it will be submitted for moderation.

Your Name

Add Tag

Please enter tags for this article, seperated by semi-colon ;

View Tag's by : # articles | # views