Notice: This website is an unofficial Microsoft Knowledge Base (hereinafter KB) archive and is intended to provide a reliable access to deleted content from Microsoft KB. All KB articles are owned by Microsoft Corporation. Read full disclaimer for more details.

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


View products that this article applies to.

This article was previously published under Q327600

↑ Back to the top


Symptoms

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


Cause

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


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

↑ Back to the top


Status

This behavior is by design.

↑ Back to the top


References

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


Keywords: KB327600, kbwebforms, kbprb

↑ Back to the top

Article Info
Article ID : 327600
Revision : 6
Created on : 7/8/2003
Published on : 7/8/2003
Exists online : False
Views : 407