Asp.Net - How to remove .aspx extension on forms: Form.Action

Asp.Net form behavior on POST
You can get rid an Asp.Net website urls from .aspx page names by two means: default page name and url rewriting.
But when an Asp.Net form page is posted, it is posted to an url that contains the .aspx page name. So a beautiful .aspx page name free form url becomes ugly again as soon as it is posted.
How to change that behavior
You can change that. You first need the server to have at least .Net Framework 3.5 SP1 installed.
Then you need your form code to change its Form.Action page property. This property is not documented. It has a strange behavior. Its value can be read except on the first event (OnPreInit), and it always contains an empty string.
  • If you use the default page name, you can use "." value.
    If your page contains a <base> tag, you must use "./"
  • If you use the url rewriting module, use the page absolute url terminated by "/". This also works when using default page name.
If you do not respect these rules, some weird error messages will occur. For instance, HTTP 405 or 405.1 error related to missing rights or 500.50 URL Rewrite Module Error.
From .NET Framework 4.0
From .NET Framework 4.0 all of this is supposed to be over. Form.Action is automatically properly set.
But wait: encoded urls, including their query are decoded, then unproperly reencoded.
Forms Authentication
Do not try to use url rewriting on a authentication form to remove .aspx page extension. You cannot. Argh...