Wrox Programmer Forums
|
BOOK: Beginning ASP.NET 4 : in C# and VB
This is the forum to discuss the Wrox book Beginning ASP.NET 4: in C# and VB by Imar Spaanjaars; ISBN: 9780470502211
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning ASP.NET 4 : in C# and VB 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 August 23rd, 2011, 09:08 PM
Registered User
 
Join Date: Aug 2011
Posts: 3
Thanks: 2
Thanked 0 Times in 0 Posts
Default Chap. 7 Multiple Default.aspx pages

Imar, I have a question about naming multiple pages in this project as default.aspx. This is in regards to the root file and the two files in the Reviews and About folders, respectively. Isn't it a bit dangerous to have multiple files in the same project with the same name? Is there some compelling reason to do this the way you have illustrated or for us that are a bit edgy about such things, would it not be prudent to assign unique names?

Just curious! Thanks!!!
 
Old August 24th, 2011, 01:38 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Hi there,

Why would it be dangerous? I typically think of uniqueness by taking the full path into account. The following paths all result in a unique URL:

/Default.aspx
/About/Default.aspx
/Reviews/Default.aspx

The reason for this naming convention - besides the convention to name them Default.aspx - is "default documents". Because of the way the web server works and is configured out of the box, the web server will try to serve Default.aspx if you don't specify a file name, enabling you to request the three pages from above as follows:

/
/About/
/Reviews/

This results in shorter, and easier URLs.

Hope this helps,

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!
 
Old August 25th, 2011, 05:01 PM
Registered User
 
Join Date: Aug 2011
Posts: 3
Thanks: 2
Thanked 0 Times in 0 Posts
Default

Thanks! Ok, I now understand the reason for the naming. I said "dangerous" because a total noob like me could easily blow away a lot of work through a misdirected copy and paste action. I'll try to be careful.
 
Old August 25th, 2011, 05:57 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

That's where good backups or source control systems such as Team Foundation Server come in handy.... :-)

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:
Wrong Planet (August 25th, 2011)





Similar Threads
Thread Thread Starter Forum Replies Last Post
Code for Chpt.2-Wrox File Share is missing Default.aspx and Default.aspx.vb bzoni BOOK: ASP.NET 2.0 Instant Results ISBN: 978-0-471-74951-6 1 October 23rd, 2009 02:39 PM
Slow default.aspx after changes slas7713 BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 8 September 21st, 2006 11:04 AM
default.aspx Louisa ASP.NET 1.0 and 1.1 Basics 4 October 14th, 2005 11:55 AM
Chap. 15, pages 689-690 : Help ! A. GRebstad BOOK: Beginning ASP 3.0 3 August 18th, 2003 04:23 AM





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