1

Assume there is a asp.net 4.0 web application and it has a default.aspx and default.aspx.cs files in it. After I build the project, a dll that is named of the project created in the bin folder. So what the dll contains ? All code behind files compiled versions ?

If the aspx files still refers its CodeBehind file like below, then does the dll used for this aspx file or still code behind is valid to run the project ?

<%@ Page Title="Home Page" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true"
    CodeBehind="Default.aspx.cs" Inherits="WebApplication3._Default" %>
Barış Velioğlu
  • 5,709
  • 15
  • 59
  • 105
  • Bear in mind that this depends on your project type and your build options, web site and web application behave differently – Andrei Dvoynos Nov 12 '12 at 14:00

3 Answers3

5

In a Web Application, all your C# code is contained within the DLLs in the bin directory. There are a couple of exceptions, such as DLLs that you rely on that live in the GAC, for example. Using a web application ( your question says this is what you are using ), you do not need to deploy your *.cs code behind files.

A Web Site is different. Changes are detected and recompiled on the fly. You'll need to include your C# files code-behind files when creating a Web Site type project.

ASP.NET Web Site or ASP.NET Web Application?

Community
  • 1
  • 1
Paul Alan Taylor
  • 10,474
  • 1
  • 26
  • 42
0

A DLL is a library that contains code and data that can be used by more than one program at the same time:

What is a DLL?

Code-behind refers to code for your ASP.NET page that is contained within a separate class file. This allows a clean separation of your HTML from your presentation logic:

ASP.NET Code-Behind Model Overview

IrishChieftain
  • 15,108
  • 7
  • 50
  • 91
0

The code gets compiled into the assembly produced by your web project. You can change its name and default namespace as part of project options.

As I understood it, the ASPX file is only used IF the project is marked as being updatable, otherwise it is just a placeholder file.

Lloyd
  • 29,197
  • 4
  • 84
  • 98