Powered by Blogger.

Sunday, February 16, 2014

The App_Code Folder in Asp.Net

The App_Code folder is a special ASP.NET 4 folder. It’s designed specifically to hold code files, like classes that you’ll use throughout the site. Code that only applies to one page (like the handler of a Button control’s click) should remain in the page’s Code Behind.

To add the App_Code folder to your site, right-click the site’s name in the Solution Explorer and choose Add ASP.NET Folder -> App_Code. The folder is added to the site and gets a special icon like a folder with a little code document on top of it.

With the App_Code folder in place, you can start adding class files to it.Class files have an extension that matches the programming language you have chosen for the site: .cs for C#.Net files and .vb for files containing VB.NET code.

Inside these class files you can create classes that in turn contain methods (functions and subroutines) that can carry out common tasks.