Microsoft KB Archive/327600

= PRB: Action Attribute Always Uses Current Page for Server-side Form Tags in ASP.NET =

Article ID: 327600

Article Last Modified on 7/8/2003

-

APPLIES TO


 * Microsoft ASP.NET 1.1
 * Microsoft ASP.NET 1.0

-



This article was previously published under Q327600



SYMPTOMS
When you declaratively set the action attribute for a server-side  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.



CAUSE
In ASP.NET, you must include the runat=server attribute value for a  tag when you use server controls. When you set a  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.



RESOLUTION
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 References section of this article.



STATUS
This behavior is by design.

