BCA Sem 5 | Unit 1 | ASP.NET
Types of Files in ASP.NET
Every extension has a purpose — here's what each ASP.NET file actually does
Unlike a simple HTML website with just .html files, an ASP.NET application separates design, logic, configuration, and data into different files. This makes large projects easier to manage, debug, and update — a key idea behind ASP.NET's architecture.
├── Default.aspx // UI design page
├── Default.aspx.cs // Code-behind logic
├── Site.master // Master/layout page
├── Global.asax // App-level events
├── Web.config // App settings
├── 📁 App_Data/ // Database files (.mdf)
├── 📁 Scripts/ // .js files
├── 📁 Styles/ // .css files
└── 📁 bin/ // Compiled .dll files
1️⃣ Page & Code Files
Web Form Page
Contains the HTML and server controls — the design/UI part of a page.
Code-Behind File (C#)
Contains the C# logic for the .aspx page — event handlers, business logic.
Code-Behind File (VB)
Same as above, but written in VB.NET instead of C#.
Class Files
Plain C# or VB.NET classes used for reusable logic across the app.
2️⃣ Configuration Files
Web.config
Stores app settings, connection strings, security rules, and custom errors.
Global.asax
Handles application-level events like Application_Start, Session_Start.
Solution File
Used by Visual Studio to organize one or more related projects together.
Project File
Contains project settings, references, and a list of all included files.
3️⃣ Data & Service Files
SQL Server Database
Local SQL Server database file, often stored inside App_Data folder.
XML Data File
Stores structured data, often used with datasets or configuration.
Web Service File
Defines a traditional SOAP-based ASP.NET Web Service.
WCF Service File
Defines a Windows Communication Foundation (WCF) service endpoint.
4️⃣ Design & Asset Files
Master Page
Defines a common layout (header, footer, menu) shared across multiple pages.
Stylesheet
Controls the visual styling — colors, fonts, layout — of your web pages.
JavaScript File
Adds client-side interactivity — validation, animations, AJAX calls.
Skin File
Defines themes — predefined appearance settings for server controls.
5️⃣ Special & Compiled Files
User Control
A reusable mini-page (like a header or login box) that can be embedded anywhere.
Compiled Assembly
Compiled binary code stored in the bin folder — the "built" version of your project.
Resource File
Stores text, images, or strings — often used for multi-language support.
Site Map File
Defines the navigation structure of the website for menus and breadcrumbs.
| Extension | File Name Example | Purpose |
|---|---|---|
.aspx | Default.aspx | Web Form page — UI design |
.aspx.cs | Default.aspx.cs | Code-behind file (C#) |
.master | Site.master | Shared layout/master page |
.ascx | Header.ascx | Reusable user control |
.asax | Global.asax | Application-level event handling |
.config | Web.config | App settings & configuration |
.asmx | Service.asmx | SOAP Web Service |
.svc | Service.svc | WCF Service |
.mdf | Database.mdf | SQL Server database file |
.sitemap | Web.sitemap | Site navigation structure |
.skin | Default.skin | Control appearance/theme |
.resx | Strings.resx | Resource/localization data |
.dll | MyWebApp.dll | Compiled assembly |
.sln | MyWebApp.sln | Visual Studio solution file |
.csproj | MyWebApp.csproj | Project configuration file |
Notice the CodeFile attribute — this is what links the two files together:
.aspx file and .aspx.cs file are not properly linked through the CodeFile and Inherits attributes.
- .aspx = Web Form page (UI) | .aspx.cs = Code-behind (logic).
- .master = Master Page for shared layout across multiple pages.
- .ascx = User Control — a reusable mini component.
- .asax = Global.asax — handles application-level events.
- .config = Web.config — stores settings & connection strings.
- .asmx = SOAP Web Service | .svc = WCF Service.
- .mdf = SQL Server database file, usually in App_Data folder.
- .dll = Compiled code, stored in the bin folder.
- .sln and .csproj manage the overall Visual Studio project.
- Each file type keeps the project organized — separating design, logic, config, and data.
