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

  • SEARCH
  • Home
  • 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 366953
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T13:40:54+00:00 2026-05-12T13:40:54+00:00

In the transition from classic ASP to Asp.Net some developers took to putting their

  • 0

In the transition from classic ASP to Asp.Net some developers took to putting their server side code in a block at the top of their HTML ala:

<%@ Import Namespace="MyDll" %>

<script runat="server">
    void Page_Load()
    {
    }
</script>

This single-page model has some advantages as Jeff Atwood describes, however, in my experience I have seen nearly all code put in a separate code-behind file in recent times (ie with VS 2008).

Nevertheless, it turns out a colleague strongly prefers the single file (inline) method over the separate code-behind method.

What are the strengths and weaknesses of each approach? (I’ve noticed that code collapsing and #regions don’t seem to be supported. Also the pages get rather long and there is no longer the visual separation of client and server side code. Can you tell I have a preference?)

I realize that variations of this question have been asked before, but I haven’t seen anyone actually spell out specifically the pros and cons of each method.

EDIT

Thank you everyone for your thought provoking answers. I’m still hoping for a list of strengths and weaknesses of each method. What are the actual features that each has (or doesn’t have)?

  • 1 1 Answer
  • 1 View
  • 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-12T13:40:54+00:00Added an answer on May 12, 2026 at 1:40 pm

    Generally, when working in WebForms, the trend I’ve seen is to use a code-behind. Many* WebForms applications that I’ve seen in the field have too much in their code-behinds, and the separation is almost critical just to be able to understand all the logic.

    However, in a well-designed app where the UI is only doing a UI job, and passing all the logic and heavy lifting to a different app layer, a single-file solution will often end up being more elegant and easy enough to traverse. In a way, going with the single-file solution may — in the right hands — motivate a better separation of concerns, because you don’t want that one file (which provides your UI) to get cluttered with a bunch of business logic.

    In the ASP.NET MVC model, the default is single-file. This is, again, to stress separation of concerns and good application design. (I do not know off the top of my head if the ASP.NET MVC kit provides a code-behind concept. I have not used it if it does.)

    Ultimately, YMMV. Good developers tend to write good code whether it uses the code-behind or single-file model. Bad developers tend to write bad code either way, too.

    * Obviously not ALL!

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

Sidebar

Related Questions

In a .NET C# program, is it easy to transition from FTP to SFTP?
The company that I work for is making a transition between classic ASP programs
Any recommendations for transition from single server to load balancing environment of 3 servers?
I have a classic ASP 2.0 project coming up. I mostly do ASP.NET WebForms
I'm making the transition from VB6 to VB.Net (VS 2010) and have a basic
I am using this code to transition from the current view to another and
I am attemting to transition from one UIView to another, when the user rotates
In my quest to transition from a decade of C++ to Ruby, I find
I'm unable to transition from index.html to any pages correctly. All transitions would show
I'm being in a transition from SVN to GIT and got a question for

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.