hehe, yeah i used the same code, the example in the f5 documentation is really, really bad.
at action you use the url of the big-ip my.policy page, nothing else needs to be modified.
then go to the virtual server, get redirected to the webserver you are hosting above code, fill in data, POST and end up authenticated. that is how it works for me.
{extra}
if F5 is reading, im talking about
"Figure 6.2 External logon page submission sample" at this page:
http://support.f5.com/kb/en-us/products/big-ip_apm/manuals/product/apm-config-11-4-0/apm_config_general_actions.html
this can be made actually useful by changing to the code from Step 1 from this page:
https://devcentral.f5.com/wiki/APM.AcceptPostedCredsfromExternalSite.ashx