Re: Code Behind vs not
From: JStemper (JStemper_at_discussions.microsoft.com)
Date: 02/25/05
- Next message: Roy: "Re: Setting label = datasource..."
- Previous message: Karl Seguin: "Re: Opinion of using "this" keyword on C# ASP.NET pages?"
- In reply to: Kevin Spencer: "Re: Code Behind vs not"
- Next in thread: Alan Silver: "Re: Code Behind vs not"
- Messages sorted by: [ date ] [ thread ]
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
> >>
> >>
> >>
>
>
>
- Next message: Roy: "Re: Setting label = datasource..."
- Previous message: Karl Seguin: "Re: Opinion of using "this" keyword on C# ASP.NET pages?"
- In reply to: Kevin Spencer: "Re: Code Behind vs not"
- Next in thread: Alan Silver: "Re: Code Behind vs not"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|