Changing the action attribute of an HtmlForm
In these last days I’ve went back to ASP.NET world (server side) since I’m thinking in rewriting my ASP.NET book (which was written way back when ASP.NET 2.0 was released and which got a slight updated for .NET 3.5). One of the things I’ve noticed is that now we can change the action attribute of a form and it sticks! According to my investigations, this behavior was changed with the release of .NET 3.5.
Now, you might be thinking on why you’d want to use this attribute…it’s specially cool when you’re using friendly urls (remember: in the past, we didn’t had any url routing engines). Suppose you’re using the old friendly urls introduced by ASP.NET 2.0:
<add url="~/Activities" mappedUrl="~/Activities.aspx"/>
Now, the problem with pre-3.5 releases was that you couldn’t set the Action property and you’d end up getting the Activites.aspx in your browser’s location box. There were some hacks, but….they were simply hacks…With the 3.5 behavior change, those hacks can finally go back into the garbage bin! hurray! :)