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" %>
1
  • Bear in mind that this depends on your project type and your build options, web site and web application behave differently Commented Nov 12, 2012 at 14:00

3 Answers 3

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?

Sign up to request clarification or add additional context in comments.

Comments

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

Comments

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.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.