Language="C#" required in code in front

F

fred

Does anyone know why Language="C#" is required in the code in front of
aspx and ascx files?

for example in the header of my aspx file:

<%@ Control Language="c#" Inherits="Blah.Apps.Controls.Announcement"
CodeFile="Announcement.ascx.cs" %>

if i don't have that in the header, Announcement.ascx.cs in the IDE (VS
2005) will blow up with object does not exist in current context on any
c# code dealing like namespace declarations.

in vs2005 i have tools>options>text editior>file extension set for the
extension .cs - Microsoft Visual C# so shouldn't the aspx.cs and
ascx.cs know to use language C# without explicitly setting it in the
code in front header?

Any info on this is appreciated. Thanks.

- Fred
 
F

fred

oops MT i meant "for example in the header of my ascx file:" instead of
"for example in the header of my aspx file:"
 
G

Greg Young

The language=C# bit is referring to any embedded code it may come accross
within the aspx/ascx .. the aspx/ascx is dynamically compiled (at run time
by the asp.net host in IIS) into a class which inherits from your base
class. When this happens your code behind source file is nowhere to be found
(it is already compiled into the .dll)

Cheers,

Greg Young
MVP - C#
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top