Code Behind vs Code Seperation

The pre-whidbey code-behind model used inheritance which had plusses and minuses from a development perspective.  The new model uses partial classes for web environments.  After some experimenting with Whidbey I'm becoming somewhat anxious as to the new programming model.  

It seems that I will be unable to seperate logic completely from user interface, as with the current model, I can build the assembly for the application and deploy it, and leave the aspx files seperate from the assembly. This allows us to change the user interface after deployment, or provide quick hotfixes by overriding methods using server-side script tags. I have heard that the options will be to release the source code with the site, which I find to be unacceptable from an IP standpoint, or to compile everything into a single assembly.
I prefer the environment that I have set up for development and deployment, as it allows me to schedule builds of a web application much like I would a windows application, and manage a structured escrow and release process, the model I'm seeing for Whidbey seems to go against that method of thinking.
I've noticed that a "Web Site" is a seperate project type than a standard project, and I seem to be unable to create a complex web project with both ASPX and custom classes and components.
Finally, Although I still have some reading and experimenting on the possible values of the @Page directive in whidbey, it seems to me it is not possible to inherit the page from a different class. Before I could add new functionaity to a base class that inherits from System.Web.UI.Page and change the page inheritance to my base class. Is this still possible?
Ron A. Buckton
Senior Consultant
Microsoft
0
rbuckton
12/4/2003 2:55:05 PM
asp.net.getting-started 91979 articles. 3 followers. Follow

2 Replies
882 Views

Similar Articles

[PageSpeed] 29

With Whidbey you can separate logic from interfaces. Just simply call your other layers components from the partial code. You can use separate assemblies with no problems, add them to the \bin folder. You don’t need to use the new \code folder if you don’t want to distribute your source codes. You can now even protect your .aspx pages.

This is done with the pre-compilation tool. This tool will compile all of your code including web forms and user controls etc into assemblies, so no one can see how the UI is implemented.
You can schedule the aspnet_compiler.exe to recomile your web project, or you can compile your whole solution.
>I seem to be unable to create a complex web project with both ASPX and custom
>classes and components.
I can’t see why you shouldn’t. You can create a solution and add web site project and class libraries just like before. But with the alpha version you can’t add references to the web project, the reference feature is rebuild from the beginning and will be available in the beta timeframe.
>Finally, Although I still have some reading and experimenting on the possible values
>of the @Page directive in whidbey, it seems to me it is not possible to inherit the
>page from a different class. Before I could add new functionaity to a base class that inherits from
>System.Web.UI.Page and change the page inheritance to my base class. Is this still possible?
Yes, it’s still possible:
<%@ page language="C#" inherits="Test.MainPage"%>
using System.Web.UI;
namespace Test
{
public class MainPage: System.Web.UI.Page
{

}

}

/Fredrik Normén - fredrikn @ twitter

Microsoft MVP, MCSD, MCAD, MCT

ASPInsiders
My Blog
0
Fredrik
12/4/2003 4:56:41 PM
This article goes over all the main possibilities, including inheritance.
Thanks, Paul Wilson, ASPInsider, MC**

For the best .NET code, examples, and tools, visit:
WilsonDotNet.com, WilsonWebPortal.com, ORMapper.net
0
PaulWilson
12/4/2003 7:23:01 PM
Reply:

Similar Artilces:

Code behind vrs. non code behind in VS.NET 2003
Does anyone know what the advantages and disadvantages are for using code behind vrs. non code behind in Visual Studio.Net 2003? One important difference is that you are able to separate the design of a web site from the code. This makes for ease of maintainablity and much more structured applications. If you ever worked with classic ASP the code-behind is a great invention. sivilianMy Weblogs...

Seperating Admin code in code-behind from general code
Hi guys, I just want to know if it would improve the functioning of my site to create two seperate dlls: One of the dll's would contain all the code for the general functioning of the site, and the other dll would contain all of the code for the administration elements of the site. Thanks GP...

code behind vs non code behind
hi,How do I gain access to server objects and events when I am using code behind? When I am using code behind in C#, I do not have access to server objects & events on my drop down list. However, when I do not use code behind, I have access to server objects & events on my drop down list.  Thanks.  You always have access to server controls from code-behind.  If your dropdownlist ID="DDL1", you can access it using Me.DDL1Please remember to click “Mark as Answer” on the post that helps you.This can be beneficial to other community members reading the thread.T...

Code Behind vs. Non-Code Behind
If you do not use Code Behind will the only thing you need is the .aspx file??? What is the benefit of code behind? I want to know the benefits.Moojjoo Õ¿Õ http://www.mmwebs.comhttp://moojjoo.blogspot.com/ The reason I ask about benefits is because everybook or place I read about ASP.net they do not, I repeat "DO NOT use CODE BEHIND" Even my MICROSOFT ASP.NET Step by Step book does not use it.Moojjoo Õ¿Õ http://www.mmwebs.comhttp://moojjoo.blogspot.com/ From a runtime perspective there is very little difference, howev...

what about the code-behind (code behind)
One MAJOR difference between AJAX.NET and Atlas.NET seems to be that AJAX.NET is able to expose methods in your codebehind to the client. Why doesn't Atlas do this? Or am I mistaken? With AJAX.NET it's just a simple line or two:  Ajax.Utility.RegisterTypeForAjax(GetType(myClass)) <Ajax.AjaxMethod()>Public Function myFunction PLEASE tell me Atlas has something comparable to this. I don't have the time to rewrite all my code-behind methods in javascript or atlas script. All you need to do in Atlas to expose a method on your page (or its code behind class) is to put a [WebMet...

Code Behind or not Code Behind
Ok i am confuse now.... A lot of books are showing pages without code behind (the code is integrated in the .aspx) Is it better to use the code behind or not. Is there any difference between using VB.NET or C#.NET except for the code synthax. Thank you and come again. A lot of samples show inline code just for simplicity.. i personally use code-behind because I like to seperate my code from presentation. As for VB.NET or C#, its your preference.. there is no difference really when its all said and done. From a purely mathematical sense, having everything in a single file would s...

inline code vs code behind
does inline code get compile in the aspx page? if does, is there any performance advantage between code behind and inline code? Thanks. ASPX pages get compiled the first time they are hit, regardless of whether there is code-behind or not. There is no performance advantage to code-behind, it is all about "better" design and maintenance.Thanks, Paul Wilson, ASPInsider, MC**For the best .NET code, examples, and tools, visit:WilsonDotNet.com, WilsonWebPortal.com, ORMapper.net thanks for your comment. "It is all about better design and maintenance", I wi...

Page Code VS Code Behind
Is there a way to turn-off code behind for asp.net and write script on .aspx altogether? Regards: Waqas Mahmood Khan PakistaneMale ;) It's up to you. Simply don't use code behind if you don't want it. VS.NET will automatically create code behind files for you. It is a better way to organise your code, although the downside is that you must rebuild more often. Keith PattonTechnical Director Ethical Media http://www.ethicalmedia.com You can use Asp.Net Web Matrix Right now , Visual Studio standard is to use code-behind. I've gotten used to it, and it does help seperat...

inline code vs code-behind
Could someone please tell me how I would do the following with "code-behind" instead of using inline code as I have done below? <table> <tr><td>whatever</td></tr> <% If IsAllowed("00100000") = True Then Response.Write( "<tr><td>more text</td></tr>") %> </table> in aspx page: <asp:Table> <asp:TableRow ID="moreText"> <asp:TableCell> more text </asp:TableCell> </asp:TableRow> </asp:Table> in code ...

Code Inline Vs Code Behind
 I recently started learning ASp.net and coming from a php background a tend to favor code inline as oppose to code code behind. But most professional articles are using code behind which indicates that it is the insdutry standard. I am really not sure which one would be more beneficial to me here. Please let me know your guys's opinion on this. Should i learn code inline first and then code behind or go straight to code behind?  I have to say so far code inline appears easier to understand, but code behind makes sense (separating logic from the User interface). Also, would you...

what is in-line code vs code-behind?
I hear these terms thrown around alot but cannot find a definition. I am using webmatrix.(is it a step down from Dominatrix?) "In-line" code is classic asp-like server side scripting placed in the aspx file iteself.Code-behind is seperate class files for the aspx / ascx files which get compiled along with the aspx page. Hope this helpsSam CromerSenior .NET Developer the code behind is the code that you write behind the aspx file it will be aspx.vb or cs  the inline code where you place the code in the HTML file for the page......!!! what is better ??? ....... it is better to use inl...

Code Blocks vs. Code Behind
I'm currently building an ASP.Net MVC demo for our company, with the goal to win them over that it is a feasible pattern/framework for us to use.  One thing I'm struggling with is the benefits and drawbacks to to using code blocks, <% %>, to fill the page with data, create forms, etc., versus using server controls and filling their values in the code behind. I know this is a loaded question, but any argument for or against would be welcomed. Hey! I would like someone to answer this as well!  To me adding inline scripting blocks (<%%>) reminds me of classic a...

code behind vs one file code
hi, I realized that there are two ways to create a web page in asp.net . either put allthe code in one page and use the tags to separate the server code from the client code. or use what vs.net offers, code behind aspx and aspx.vb The question is what is better to develop with and what if I have an asp page that was created in vs.net with code behind and I need to make it one file. thanks for your help AlNew to Asp.net depends what you mean by 'better'. that's a personal preference thing. Personally I like to split content from code, but some others find it strange. the codebehin...

in line coding vs code behind
Hi Let me know which methos is secure for coding in line coding  or   code behind Please give some fact and refrence Thanks   What do you mean what is more secure they are both .NET code Inline coding and code behind were meant just to separate server side code for client side code, coming to security aspect both don't make any difference as once u'r application is deployed, u'r server side code will be made a DLL The IDE has full support for inline code, which includes IntelliSense not just for code, but for HTML, ASP.NET tags, client script, p...