views:

332

answers:

2

I have a .Net app running in IIS6. The app dlls are compiled against the 3.5 framework, which is installed on the server. The app works. I hit an aspx page that has no codefile; it is an .aspx page only, which has inline code in tags. Code declares auto properties as such:

protected String PlaylistUrl { get; set; }

When I request the page, I get the following error:

"ASP.mynamespace_foo__foo_bar_aspx.PlaylistUrl.get must declare a body because it is not marked abstract or extern"

I understand that the error is thrown because 2.0 compiler doesn't understand auto properties. 3.5 is installed on box. I don't know how to force an .aspx to use 3.5 compiler. codeDom node in web.config is not an option, as that node is only recognized by IIS7. Any thoughts?

+1  A: 

Presuming you are using Visual Studio 2008 then you can set the version of the .NET runtime you are targeting in the project properties.

In Solution Explorer, right-click the project name and then click Properties Pages and the go to the Build tab. You should see a dropdown of available versions. See MSDN for more info.

Dan Diplo
Right - that's been done. Regardless, again, this is an .aspx page w/ no code behind, so I don't think the proj properties are going to come into play here. Thanks for response though.
Chris
+1  A: 

Look at this question. You need to update the codedom section in web.config

Arve
Arve - thanks for the response, but did you see my original question? This is IIS6, and the codeDom node only applies to IIS7, so it is ignored by IIS6. Regardless, the codeDom is in the config and is as such: <compilers> <compiler language="c#,cs;csharp" extension=".cs" type="Microsoft.CSharp.CSharpCodeProvider,System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" warningLevel="4"> <providerOption name="CompilerVersion" value="v3.5" /> <providerOption name="WarnAsError" value="false" /> </compiler> </compilers>
Chris
I fixed it, but I'm not telling
Chris
Thanks for the heads-up Arve. I don't have access to an IIS 6 installation at the moment but gave into temptation to post anyway.
Jeff Sternal
The problem was this:1) I was wrong - the system.codeDom node is NOT ignored by IIS62) The page language in the declaration of the .aspx is c#, but that language was missing from the codeDom language attribute. I had language="cs;csharp" (note the missing c#). After I changed the language attribute to language="c#;cs;csharp" (note the inclusion of the c#), the page loaded w/o errors.Thanks for all the responses!
Chris