By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,464 Members | 1,616 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,464 IT Pros & Developers. It's quick & easy.

Language="C#" required in code in front

P: n/a
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

May 11 '06 #1
Share this Question
Share on Google+
2 Replies


P: n/a
oops MT i meant "for example in the header of my ascx file:" instead of
"for example in the header of my aspx file:"

May 11 '06 #2

P: n/a
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#
"fred" <fr***@fool.com> wrote in message
news:11*********************@j73g2000cwa.googlegro ups.com...
oops MT i meant "for example in the header of my ascx file:" instead of
"for example in the header of my aspx file:"

May 11 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.