When you declaratively set the action attribute for a server-side <FORM> tag in an .aspx page to anything other than the current page, the
value appears to be ignored. In the HTML source, the action attribute is always the current page, regardless of how you set
the value at design time.
↑ Back to the top
In ASP.NET, you must include the runat=server attribute value for a <FORM> tag when you use server controls. When you set a <FORM> tag to use runat=server, the action attribute is always set to use the current page. By controlling
the action attribute so that it is always set to the same page reduces
potential view state issues and other related unknown issues that may occur.
↑ Back to the top
Although the action attribute is always set so that an .aspx page posts to itself,
you can use other methods to get the result that you want. For example, you can
call Response.Redirect in server-side code. The page will post back to itself and then
redirect to the destination page based on logic in an event handler. For more
information and for a sample that uses Response.Redirect, see the
section of this article.
↑ Back to the top
For additional information about how to use Response.Redirect
in ASP.NET, click the following article numbers to view the articles in the
Microsoft Knowledge Base:
312063�
HOW TO: Use Response.Redirect in ASP.NET with Visual Basic .NET
307903�
HOW TO: Use Response.Redirect in ASP.NET with Visual C# .NET
↑ Back to the top