Click here to Skip to main content
15,881,715 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

In an ASP.NET application, it's possible to add a special APP_CODE folder. Why would I do this? Is there anything that I need to consider such as special types of files that go in here?

:)
thanks
Posted
Updated 18-Nov-10 0:55am
v2

In a Web site project, you can store source code in the App_Code folder, and it will be automatically compiled at run time. The resulting assembly is accessible to any other code in the Web application. The App_Code folder therefore works much like the Bin folder, except that you can store source code in it instead of compiled code. The App_Code folder and its special status in an ASP.NET Web application makes it possible to create custom classes and other source-code-only files and use them in your Web application without having to compile them independently.

The App_Code folder can contain source code files written as traditional class files — that is, files with a .vb extension, .cs extension, and so on. However, it can also include files that are not explicitly in a specific programming language. Examples include .wsdl (Web service description language) files and XML schema (.xsd) files. ASP.NET can compile these files into assemblies.

The App_Code folder can contain as many files and subfolders as you need. You can organize your source code in any way that you find convenient, and ASP.NET will still compile all of the code into a single assembly that is accessible to other code anywhere in the Web application.
 
Share this answer
 
Comments
call to .net 18-Nov-10 6:54am    
thanks for quick reply but we put here some specific type file like detail of common file or common function.
Sandesh M Patil 18-Nov-10 6:58am    
you can put common function there inside the class name.

Ex. Employee class

Class Employee
{
public bool AddEmployee(int EmpId, string name, string address)
{
}
public bool deleteEmployee(int EmpId)
{
}
}

you can access this functions by creating an object of that class anywhere in your project.
Here is all you need to know about App_Code folder in asp.net - Clickety[^]

Edit: Fixed the link.
 
Share this answer
 
v2
Comments
Sandesh M Patil 18-Nov-10 7:39am    
Its not googled correctly. Its googled for app_c. Also i was NOT down voting you ;)
Ankur\m/ 18-Nov-10 7:44am    
I have already mentioned it before and I am saying it again - there is some problem with link pasting. It was reported some time back.
You could have corrected the link instead of down-voting. Anyways, I will do it.
Sandesh M Patil 18-Nov-10 7:44am    
I was not down voting you sorry for prev comment ;(
Sandesh M Patil 18-Nov-10 7:46am    
5 from me for correct answer
Ankur\m/ 18-Nov-10 7:48am    
Thanks, but do remember to fix such things if you find again.
Have a look at this article: Beginner's Guide to ASP.NET Application Folder[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900