Re: Code Behind vs not

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: JStemper (JStemper_at_discussions.microsoft.com)
Date: 02/25/05


Date: Fri, 25 Feb 2005 07:15:07 -0800

Two more points to consider:
1. When inline code is deployed to a production server you now have server
side source code in plain text on a production server. If the server is
compromised the code now becomes visible.

2. If you have an error during compile time it will occur on the production
server. At least with code behind the compile time error will occur on your
development machine.

John Stemper

"Kevin Spencer" wrote:

> Good point, Mike!
>
> --
>
> Kevin Spencer
> Microsoft MVP
> ..Net Developer
> Neither a follower nor a lender be.
>
> "Mike Hanson" <MikeHanson@discussions.microsoft.com> wrote in message
> news:FF1F25D4-6935-4818-A546-1947E89B80ED@microsoft.com...
> > This discussion seems to have focused mostly on complexity and coding
> > styles,
> > and missed one of the key benefits of code behind.
> >
> > When you use code behind, all of the classes that are created for your
> > pages
> > are compiled into a single assembly which effectively becomes the
> > executable
> > for your web app. Once the app is started, the assembly is loaded and all
> > classes are available as presentation service components for the pages.
> > They
> > never need to be recompiled in the production environment
> >
> > In contrast to this, when you use an inline coding style each page has to
> > be
> > compiled on the fly on it's first request. The compiled page is then
> > cached
> > so it is faster for subsequent requests, however my observations show that
> > even though the compiled page assembly is still on disk after a restart of
> > IIS or the computer, it appears to be invalidated and is re-compiled on
> > first
> > request again.
> >
> > The only advantage I have seen for inline coding is that you can post to
> > another page, which has proven useful when using online payment systems
> > that
> > require you to post to a form or cgi script on the vendor site. This is
> > changing in ASP.NET 2.0 so then there will be no need to use the inline
> > style
> > at all.
> >
> > Every thing I have read, and conversations I have had with MSFT contacts
> > involved in developing ASP.NET suggest that the only reason the inline
> > coding
> > style is available at all is to ease the transition for the thousands of
> > ASP
> > developers who never really learned how to program.
> >
> >
> > "tshad" wrote:
> >
> >> I am just trying to decide whether to split my code and uses code behind.
> >> I
> >> did it with one of my pages and found it was quite a bit of trouble.
> >>
> >> I know that most people (and books and articles) like it because you can
> >> split the code from the design. That is logical. But if you are the
> >> only
> >> one working on the code, it seem a little overkill.
> >>
> >> I use Dreamweaver to do my design and find it a bit of a hassle to have
> >> multiple files open for each of my pages as I am working on them. I
> >> typically have 3 or 4 pages open at one time that I am working on which
> >> translates into 6-8 files open.
> >>
> >> If I add an object to my design page I need to go the codebehind page to
> >> define it there. If I was working with multiple people on a page, I
> >> would
> >> need to run over to the person working on the codebehind and tell him to
> >> add
> >> the new object to his page.
> >>
> >> Things that are assumed on the .aspx page are not assumed on the
> >> codebehind
> >> and have to be explicitly defined.
> >>
> >> None of this is really talked about when codebehind is mentioned.
> >> Normally,
> >> you are told that it is better. Is this the case in all situations?
> >>
> >> Just trying to get other opinions on this, as I have already have about
> >> 30
> >> pages designed and am trying to decide if I should split the files or
> >> not.
> >>
> >> Thanks,
> >>
> >> Tom
> >>
> >>
> >>
>
>
>



Relevant Pages

  • Re: Question on - Automatic compilation of VB.NET files on a Web Server
    ... your production server at all. ... This will take all the code in all the .vb files and compile ... production server. ... > We are migration an ASP Web App to VB.NET. ...
    (microsoft.public.dotnet.framework)
  • Re: Problem compiling remote web in VS2005
    ... > remote webserver, which is highly unlikely that it could do. ... I develop from home on a staging server in the datacenter of my company ... computer create a new project and develop and compile on it from my laptop ... >> I've setup a new website in IIS, enabled .net, fpse, etc. ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: XKB problem with x-terminal
    ... >>> Is there a way to compile keyboard definitions for X and save them ... >> where you can make the X server load it upon startup using the option ... * you can't keep the X server from wanting to call xkbcomp, ... * you are expected to specify the bare name of the keymap (without the ...
    (Debian-User)
  • Re: Image URL?
    ... I did not put MYWEBSITE under Inetput. ... Production Server c:\MYWEBSITE\userControls ...
    (microsoft.public.dotnet.framework.aspnet)
  • Why I dont believe in static typing
    ... relative merits of static versus dynamic typing I thought I'd spoil it all ... delivered by an ad server, which was already up and running. ... to part of the system, compile it, and the compiler errors would point you ... The introduction of credit card billing ...
    (comp.lang.lisp)