Chris
Chris

Reputation: 3

must declare a body because it is not marked abstract or external - error thrown from aspx page w/ no code behind

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?

Upvotes: 0

Views: 4215

Answers (2)

Arve
Arve

Reputation: 7516

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

Upvotes: 2

Dan Diplo
Dan Diplo

Reputation: 25359

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.

Upvotes: 1

Related Questions