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 15th, 2010, 08:51 AM
Authorized User
 
Join Date: Jul 2010
Posts: 81
Thanks: 10
Thanked 3 Times in 2 Posts
Default Relative URLs Ch 7 (pp 240-243)

Great Sunday morning.

I understand the ~ and tried it on my website. It's in the MasterPages directory off the root of my site. It works as you can see at www.bdtcomp.com/iis6/ . This is how my header reads:

Code:
<h1 align="center"><img src="/images/bdtcompbanneraug12_08.jpg" alt="Freighter under Blue Water Bridge" width="740" height="175" /></h1>
Now when I change it to:

Code:
<h1 align="center"><img src="~/images/bdtcompbanneraug12_08.jpg" alt="Freighter under Blue Water Bridge" width="740" height="175" /></h1>
It doesn't work.

I changed the virtual path to / also.

I'm sure it's something simple on my part, but it has me baffled or is it because I have this image in the MasterPage?;-|
__________________
Bob
bdtcomp.com
http://lettersfromasoldier.com
Follow me on Twitter
“Success is not final, failure is not fatal: it is the courage to continue that counts.”~Winston Churchill
 
Old August 15th, 2010, 09:02 AM
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,

No, it's not because of the master page; the ~ concept works globally. Take a look at the How It Works section for the exercise you're referring to (at page 243, second paragraph) for an explanation of why this doesn't work and how to fix it. Hint: <img /> is a "plain HTML control"....

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:
btcomp (August 15th, 2010)
 
Old August 15th, 2010, 10:39 AM
Authorized User
 
Join Date: Jul 2010
Posts: 81
Thanks: 10
Thanked 3 Times in 2 Posts
Default

Here is how it looks in markup code in Frontend.master

Quote:
h1 align="center"><img src="~/images/bdtcompbanneraug12_08.jpg" alt="Freighter under Blue Water Bridge" width="740" height="175" runat="server" /></h1>
Thanks Imar, It's working. Here's the new URL from the Browser source. I'm convinced.

Code:
<h1 align="center"><img src="http://p2p.wrox.com/images/bdtcompbanneraug12_08.jpg" alt="Freighter under Blue Water Bridge" width="740" height="175" /></h1>
;-)


P.S. I am thinking that my <h1> tag is wasted here. I am going to replace it and put it in my headings, better for SEO!
__________________
Bob
bdtcomp.com
http://lettersfromasoldier.com
Follow me on Twitter
“Success is not final, failure is not fatal: it is the courage to continue that counts.”~Winston Churchill

Last edited by btcomp; August 15th, 2010 at 10:44 AM..
 
Old August 15th, 2010, 11:03 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Yes, you don't need the h1 one for the logo. You should have only one h1 per page, and it should describe the site or the page.

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 15th, 2010, 01:02 PM
Authorized User
 
Join Date: Jul 2010
Posts: 81
Thanks: 10
Thanked 3 Times in 2 Posts
Default

Quote:
Yes, you don't need the h1 one for the logo. You should have only one h1 per page, and it should describe the site or the page.
Yeah, I've got my work cut out for me, but 'find and replace' will help! But fortunately the Master page will make it easy on this website.
__________________
Bob
bdtcomp.com
http://lettersfromasoldier.com
Follow me on Twitter
“Success is not final, failure is not fatal: it is the courage to continue that counts.”~Winston Churchill
 
Old August 15th, 2010, 04:34 PM
Authorized User
 
Join Date: Jul 2010
Posts: 81
Thanks: 10
Thanked 3 Times in 2 Posts
Default

Well I have my site up at www.bdtcomp.com in .aspx files. I still have some bugs, thought I made a mess.

A word of caution to others, just make sure you save any web.config files on your servers if you upload your own. Then if you get those Server errors in web.config you can always put back the saved web.config.

I guess I will need to understand these files better and also check with my hosting company too for their requirements.
__________________
Bob
bdtcomp.com
http://lettersfromasoldier.com
Follow me on Twitter
“Success is not final, failure is not fatal: it is the courage to continue that counts.”~Winston Churchill





Similar Threads
Thread Thread Starter Forum Replies Last Post
Ch 2 pp. 28 mdfinch BOOK: ASP.NET 3.5 Enterprise Application Development with Visual Studio 2008: Problem Design Solutio 7 August 24th, 2009 04:34 PM
FYI: Chapter 8, Figure 8-5, page 240 peace95 BOOK: Beginning Oracle Application Express ISBN: 9780470388372 0 June 24th, 2009 02:29 AM
Relative URLs member4953 BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3 4 May 15th, 2009 04:40 PM
Relative URLs? groupmatch BOOK: ASP.NET Website Programming Problem-Design-Solution 21 December 16th, 2004 10:53 AM





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