views:

2436

answers:

7

I have recently installed .net 3.5 SP1. When I deployed a compiled web site that contained a form with its action set:

<form id="theForm" runat="server" action="post.aspx">

I received this error.
Method not found: 'Void System.Web.UI.HtmlControls.HtmlForm.set_Action(System.String)'.
If a fellow developer who has not installed SP1 deploys the compiled site it works fine. Does anyone know of any solutions for this?

+1  A: 

I don't know the specific solution, but HtmlForm.set_Action() is a function the compiler creates that acts as the setter for a property called Action.

When you do:

public String Action { set { DoStuff(); } }

The set code actually becomes a function called set_Action.

I know it's not the best answer, but I hope it helps you find the source of your problems!

Daniel Jennings
+6  A: 

.NET 3.5 SP1 tries to use the action="" attribute (.NET 3.5 RTM did not). So, when you deploy, your code is attempting to set the HtmlForm.Action property and failing, as the System.Web.dll on the deploy target is RTM and does not have a setter on the property.

Thomas G. Mayfield
wonderful!this solved my problem!
stefano m
A: 

I just ran into the same problem. From what I understood it is indeed caused by the fact the my PC has .NET 3.5 SP1 on it, and the server to which I deployed the project doesn't.
From what I understand, one solution is that the server be updated with .NET 3.5 SP1. As I don't want to do that yet, I just removed the "action" attribute from all the forms in the project, and that solved the problem.
Read more

Lea Cohen
A: 

Could use the method here to set the form.action method:

Recursieve
A: 

All mentioned above is true...

In fact, when one installs 3.5 SP1, it automatically updates 2.0 and 3.0 with their own SP2. So, if you are using 2.0 for an application, you'll get the error.

In addition, SP1 on .Net2.0 did not cause the problem.

A: 

Hi,

There is another solution to this. Write a javascript that would set the action of the form to the expected url at Page_Load and register the script at page load.

Thanks, http://www.dilrukshidevapriya.blogspot.com

A: 

Basta instalar o framework 3.5 SP1 que funciona.

dedeco