Where to write the code

J

Jay

Hello everyone,

I just got done taking a small course in ASP.NET and I'm completely sold.
This is amazing compared to original ASP.

My question is about the preferred method of coding the asp pages. We were
taught to write our code behind the page using VS.NET but some books I've
seen have examples where you write the code right on the aspx page.

Is one of these methods more proper than the other, maybe more preferred?

Does anyone know of any pros and cons for each method?

Thanks!

- J
 
S

Steve C. Orr, MCSD

One of the worst things about old ASP was that you had to mix presentation
with logic. Messy Messy.
Code behinds files are the solution. Enjoy it.
Books tend to print examples the other way because it's easier to lay it out
that way in a book rather than having 2 separate listings for a single page.
VS.NET pretty much forces you to use code behinds way anyway.
 
G

George Ter-Saakov

I would say everything what goes to presentation layer goes into aspx.
Business logic goes to DLL.
Now the question is where Page::OnLoad belogs?

I say it's a presentation layer and the best place for it in the aspx.


George, MSCD ( I like my fancy title).
 
T

Todd Thompson

I would say everything code-wise is best in code-behind. You can still
seperate your presentation and business logic very cleanly using
code-behind, and the presentation code is much cleaner then it would in
page.

With code-behind it is also much simpler to write code (even presentation
code) that is shared across many pages.

Todd Thompson
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,083
Messages
2,570,591
Members
47,212
Latest member
RobynWiley

Latest Threads

Top