Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 3.5 > ASP.NET 3.5 Basics
|
ASP.NET 3.5 Basics If you are new to ASP or ASP.NET programming with version 3.5, this is the forum to begin asking questions. Please also see the Visual Web Developer 2008 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 3.5 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old February 11th, 2010, 09:10 PM
Registered User
 
Join Date: Dec 2009
Posts: 6
Thanks: 2
Thanked 0 Times in 0 Posts
Default Where to put classes in a Web App Project?

Hi all,

I have a basic question about ASP.NET web sites vs web application projects.

In a web site, you can right-click and “Add ASP.NET folder”, then choose “App_Code”, then put your class files in there like nature intended.

I’ve read advice that a web application project is the way to go for various reasons. If I create one, I can right-click / Add / Add ASP.NET Folder, but App_Code is not a listed option. What’s a good practice for where to put your class.cs files? (Right-click / Add / Class just puts in in the main project folder, kinda gunking it up.

Thanks!
 
Old February 11th, 2010, 11:16 PM
Lee Dumond's Avatar
Wrox Author
 
Join Date: Jan 2008
Posts: 923
Thanks: 12
Thanked 166 Times in 162 Posts
Default

You can always put them in a separate class library project (or projects) and add a reference to that project from your main web project.

Or, you could just make subdirectories in your main project folder and put them in there. If you only have a few, that'd probably be easier. For a project of any size though, I'd go with the class libraries.
__________________
Visit my blog at http://leedumond.com
Follow me on Twitter: http://twitter.com/LeeDumond

Code:
if (this.PostHelpedYou)
{
   ClickThanksButton(); 
}
The Following User Says Thank You to Lee Dumond For This Useful Post:
Amorphous Blob (February 12th, 2010)
 
Old February 12th, 2010, 03:34 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

As Lee pointed out, you can put them pretty much anywhere you like . Just don't create the App_Code folder manually and put them there, or you'll get in trouble...

Cheers,

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!
The Following User Says Thank You to Imar For This Useful Post:
Amorphous Blob (February 12th, 2010)
 
Old February 12th, 2010, 07:53 PM
Registered User
 
Join Date: Dec 2009
Posts: 6
Thanks: 2
Thanked 0 Times in 0 Posts
Default Thanks guys...

... 'preciate it!





Similar Threads
Thread Thread Starter Forum Replies Last Post
TBH converted from web project to web app. htorres BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 0 August 25th, 2008 12:44 AM
Convert a VB.Net app to a web app? furjaw VB.NET 3 September 24th, 2007 12:27 PM
App wide code - where to put it? VictorVictor ASP.NET 2.0 Basics 5 May 31st, 2006 02:20 PM
How to Build Web Classes/project into DLL? JaCkSoN Tay VS.NET 2002/2003 2 August 11th, 2005 04:55 AM
Number of Classes Per DLL project Jstmehr4u3 Pro VB 6 1 June 19th, 2003 05:21 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.