C# – HtmlForm.Action and .Net Framework 2.0/3.5 Query

.net-2.0.net-3.5asp.netc

Disappointingly, the members page for HtmlForm 2.0 is missing…

My research seems to indicate that HtmlForm.Action is a property that was added in .Net Framework 3.5. However, I'm using VS2005 and my reference to System.Web (the namespace HtmlForm is under) is to a .Net Framework 2.0 runtime version.

Further, my IIS status information also indicates I am using .Net Framework 2.0, when I force an error on my local IIS and read it. Despite this, I am able to use form1.Action successfully…but only on my local IIS.

When I try it on vms and external servers, I get [MissingMethodException: Method not found: 'System.String System.Web.UI.HtmlControls.HtmlForm.get_Action()'.] errors.

So, my question:

1) Why does it work on my local IIS? Does the fact that I have the 3.5 framework installed make a difference, here?
2) Why does it not work on other IIS? (I think this is because it's not part of .Net 2.0).

I guess I just figure that if something is running on .Net Framework 2.0, the presence of 3.5 should not make a difference. Or maybe there's some other cause for these results.

Best Answer

That's right in IIS you will see .NET Framework 2.0 even when you are using .NET 3.5. It happend because Microsoft .NET Framework 3.5 was built incrementally upon .NET Framework 2.0 and 3.0.

1) It doesn't work on the server because .NET 3.5 is not installed. You have created the .NET 3.5 project in the Visual Studio, so .NET 3.5 must be installed on the server.

2) See 1.