Friday, 9 April 2010

Form submission and URL rewriting

If you're using URL rewriting you need to prevent the real URL from displaying in the browser when a form is submitted. To do this you need to tell the form what it should be doing by placing this in your page load event, or better still in your masterpage page load event.
if ( !String.IsNullOrEmpty(HttpContext.Current.Request.RawUrl ))
        form1.Action = HttpContext.Current.Request.RawUrl;

No comments:

Post a Comment

Comments are moderated, so you'll have to wait a little bit before they appear!