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.
| Author |
: Paul Hayman |
| Published |
: 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.