-----------------------------------------------------------
New Message on MumbaiUserGroup
-----------------------------------------------------------
From: Swapnil_B1
Message 1 in Discussion
/App_code directory Part 2 Inferring the Programming Language of the
App_Code Folder
The App_Code folder is not explicitly marked as containing files written in any
one programming language. Instead, the ASP.NET infers which compiler to invoke
for the App_Code folder based on the files it contains. If the App_Code folder
contains .vb files, ASP.NET uses the Visual Basic compiler; if it contains .cs
files, ASP.NET uses the C# compiler, and so on.
If the App_Code folder contains only files where the programming language is
ambiguous, such as a .wsdl file, ASP.NET uses the default compiler for Web
applications, as established in the compilation element of the Web application
or machine configuration file. Multiple Programming Languages in the App_Code
Folder
Because the source code in the App_Code folder is compiled into a single
assembly, all the files in the App_Code folder must be in the same programming
language. For example, the App_Code folder cannot include source code in both
Visual Basic and C#.
However, you can configure your Web application to treat subfolders of the
App_Code folder as separate compilable units. Each folder can then contain
source code in a different programming language. The configuration is specified
by creating a codeSubDirectories element in the compilation element of the
Web.config file and adding a reference to the subfolder. The following example
illustrates how you would configure subfolders named VBCode and CSCode to
compile into separate assemblies:
<compilation debug="false">
<codeSubDirectories>
<add directoryName="VBCode" />
<add directoryName="CSCode" />
</codeSubDirectories>
</compilation>
The references to the VBCode and CSCode subfolders do not need to include any
information about what programming language is contained in the subfolder. As
with the App_Code folder itself, ASP.NET infers the compiler to use based on
the files in the subfolder. Security with the App_Code Folder
Security issues with code in the App_Code folder are essentially the same as
those with code in the Bin folderthe code is compiled into an assembly at
runtime. A mitigating factor is that you can read the source code for files in
the App_Code folder. However, if you do not fully understand the code, it can
still represent a security risk. Therefore, treat source code in the App_Code
folder as you would treat compiled code from the same source. Note
User controls are not allowed in the App_Code folder. This includes both
single-file user controls and user controls that use the code-behind model.
Putting a user control .in the App_Code directory causes the user control's
code to be compiled out of its required sequence and therefore is not allowed.
Note that user controls do not need to be in the App_Code folder; they are
already available to pages anywhere in the application.
My Special thanks goes to Nilesh Joshi for value adding to my previous article
on Common Language Interoperability which I have covered in detail in this
article.
Swapnil (Swaps)
http://swapsnet.spaces.live.com/
-----------------------------------------------------------
To stop getting this e-mail, or change how often it arrives, go to your E-mail
Settings.
http://groups.msn.com/MumbaiUserGroup/_emailsettings.msnw
Need help? If you've forgotten your password, please go to Passport Member
Services.
http://groups.msn.com/_passportredir.msnw?ppmprop=help
For other questions or feedback, go to our Contact Us page.
http://groups.msn.com/contact
If you do not want to receive future e-mail from this MSN group, or if you
received this message by mistake, please click the "Remove" link below. On the
pre-addressed e-mail message that opens, simply click "Send". Your e-mail
address will be deleted from this group's mailing list.
mailto:[EMAIL PROTECTED]