We are in the process of upgrading our ASP.NET 4 website from XHTML 1.0 to HTML 5. The <form> tag is generated automatically as it is ASP.NET, and it looks like:

<form method="post" action="" id="MainForm">

Almost on all pages of our website we do not have any special button that should lead to an action, so it's OK to have the action attribute empty (action=""). However, every HTML 5 validator tells us that the action attribute should not be empty.

How can we overcome this problem without changing the existing website functionality? Or, maybe, we can live with that and this will never affect such serious things as Google SERP positions, etc...?


1 Answer 1


Include this in your web.config file: <httpRuntime targetFramework="4.5"/>

According to Microsoft here (at the bottom of the page):

This behavior was changed again in ASP.NET 4.5 so that the action attribute is rendered with a value of "./". The application must however specfically target 4.5 in its web.config via the httpRuntime element.

In regards to this affecting your Google SERP, as indicated here according to Matt Cutts:

Google doesn’t look at site/page validation when determining ranking.

What you might be concerned with is if your users will have issues with their browsers, so test your page(s) with as many browsers you can.

  • 1
    Switching to ASP.NET 4.5 hosting may require serious actions on the side of our hoster (changing OS to Windows Server 2012, etc). Can we solve the problem another way? For instance, we are using the masterpage technique, and we have this declaration in our MasterPage.master: <form id="MainForm" runat="server">. Will it be ok to add say action="./" to it (can it cause some side effects)?
    – TecMan
    Feb 3, 2014 at 14:18
  • Or can we also use the 2nd workaround with the Page_PreRender event for our master page from the Microsoft Connect link you mentioned if we stay on ASP.NET 4.0?
    – TecMan
    Feb 3, 2014 at 14:18
  • After analyzing all aspx pages of this legacy web project, I guess the smartest choice will be to remove the <form> tag from the masterpage at all as it is almost never used in the 'static' pages! We can place this tag with the corresponding action attribute manually only on the pages which really require it. Agreed?
    – TecMan
    Feb 3, 2014 at 15:08
  • Yes to all the above (haven't tested them however). Your last solution sounds fine too. Also, see the Update and bottom answer in this related question on SO. BTW, validation errors won't preclude indexing or impact your SEO, so providing your code works in your target browsers, you should be fine. Search engines of course do not submit forms, so even if they don't work, that wouldn't be an SEO issue - other than potentially affecting bounce rate and related signals coming from users.
    – dan
    Feb 3, 2014 at 15:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.