Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 206903
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T17:41:16+00:00 2026-05-11T17:41:16+00:00

I understand that Web Site Projects compile source on-the-fly, and Web Application Projects pre-compile

  • 0

I understand that Web Site Projects compile source on-the-fly, and Web Application Projects pre-compile source into a DLL (much like ASP.Net 1.x).

But how is the difference specified in IIS?

I know that Visual Studio knows — there are different projects for each, etc. But the running instance (IIS + Framework) has to know which compilation model is being used, right? Because how else does it know whether or not to compile on-the-fly?

A request comes in, hits an ASPX file…and how does the process know whether the associated CS file needs to be compiled (Web Site), or if it was already done before deployment (Web Application)?

I’m just curious where this difference is specified. In the web.config somewhere?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-11T17:41:17+00:00Added an answer on May 11, 2026 at 5:41 pm

    There is a subtle difference in the .aspx file that you’ll find in these project types.

    If you look at a Web Site Project you should see something like this…

    <%@ Page Language="C#" AutoEventWireup="true"  
    CodeFile="Default.aspx.cs" Inherits="_Default" %>
    

    … where as the Web Application project will have .aspx files with something like this…

    <%@ Page Language="C#" AutoEventWireup="true" 
    CodeBehind="Default.aspx.cs" Inherits="WebApplication2._Default" %>
    

    Notice that the first has a CodeFile attribute, and the second as a CodeBehind attribute. This is where the distinction is made.

    The CodeBehind attribute is NOT used at runtime – it’s there to tell VS.NET where the code lives, and the Inherits attribute tells the runtime which class to go searching for in the binaries.

    The CodeFile attribute IS used at runtime, and is used by the aspnet_compiler.exe to generate code, and then the Inherits attribute is used as above.

    For more info on these attributes, look here…

    http://msdn.microsoft.com/en-us/library/ydy4x04a.aspx

    But to answer your question “how does IIS know?” the answer is “it doesn’t.” ASP.NET knows.

    You can prove that this is the case by doing the following:

    1. Create a new web application. This will include a Default.aspx and a Default.aspx.cs.
    2. Add the following code into Default.aspx.cs:

      protected void Page_Load(object sender, EventArgs e)
      {
          Response.Write("hello");
      }
      
    3. Compile the project, run it, see the
      text “hello” appear in a browser.

    4. Now, change the code so it looks
      like this, and save the .cs file:

      protected void Page_Load(object sender, EventArgs e)
      {
          Response.Write("goodbye");
      }
      
    5. DO NOT COMPILE. Refresh your browser. You’ll still see “hello” because the compiled code still uses this string.

    6. Now, change the attrib in Default.aspx from CodeBehind to CodeFile. Save this file.

    7. Refresh your browser. You’ll see “goodbye” displayed.

    8. Change “goodbye” in your code to “I believe!”. Save the .aspx.cs but don’t compile.

    9. Refresh your browser, see “I believe!”, and dance around the room enlightend 🙂

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 231k
  • Answers 231k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Use the following function like this: Image('/path/to/original.image', '1/1', '150*', './thumb.jpg');… May 13, 2026 at 2:13 am
  • Editorial Team
    Editorial Team added an answer Check you database schema to see if the field (referenced… May 13, 2026 at 2:13 am
  • Editorial Team
    Editorial Team added an answer I figured out the problem - there was a session… May 13, 2026 at 2:13 am

Related Questions

As I understand it software being open source does not prevent you from selling
I believe I understand fully the differences between Visual Studio 2005's web site model
One of the projects I am working on includes a website that is hosted
I have couple questions regarding some C++ rules. Why am I able to call

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.