?
Solved

URLs - relative and the use of ~

Posted on 2012-09-19
3
Medium Priority
?
289 Views
Last Modified: 2012-09-25
Hi I have a file (control) at the root of my website called topbar.ascx which holds all my navigation buttons.  The problem is I have sub-folders which also include this control on their pages.  Therefore, how do I reference a url from outside and inside a sub-folder?  I was advised to use ~.  So in my topbar.ascx I have <li><a href="~/blog/default.aspx">Blog</a></li> which you would think would be ok.  However, when I view pages including my topbar.ascx inside a browser and rollover a link, my status bar shows:

localhost:xxxxx/websitename/blog/~blog/default.aspx

Why on earth is websitename/blog/ getting added to the front of the url??  Is this an IIS issue?  I'm hoping this will be resolved when I publish live but I will be hosting the site on a shared server so maybe I will have the same issue??

Please can someone advise?
0
Comment
Question by:Lorna70
3 Comments
 
LVL 18

Accepted Solution

by:
Rajar Ahmed earned 720 total points
ID: 38413669
0
 
LVL 25

Assisted Solution

by:Rouchie
Rouchie earned 280 total points
ID: 38416722
This sounds like you are hosting on your dev machine via Visual Studio's ASP.NET server, instead of IIS.   You should use IIS ALWAYS!

Explanation
http://www.codepal.co.uk/show/ASPNET_Development_Server_causes_404_errors

Set up using IIS
http://www.codepal.co.uk/show/How_to_Debug_Visual_Studio_2010_in_IIS_instead_of_Cassini
0
 

Author Comment

by:Lorna70
ID: 38421786
Yes this is only on my development machine so I thought that maybe when hosted using IIS the problem would disappear.  I'm setting up a new pc with Windows 7 so I can have IIS on my development machine (currently Vista :-().
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Today is the age of broadband.  More and more people are going this route determined to experience the web and it’s multitude of services as quickly and painlessly as possible. Coupled with the move to broadband, people are experiencing the web via …
A quick way to get a menu to work on our website, is using the Menu control and assign it to a web.sitemap using SiteMapDataSource. Example of web.sitemap file: (CODE) Sample code to add to the page menu: (CODE) Running the application, we wi…
This Micro Tutorial will teach you how to add a cinematic look to any film or video out there. There are very few simple steps that you will follow to do so. This will be demonstrated using Adobe Premiere Pro CS6.
Are you ready to place your question in front of subject-matter experts for more timely responses? With the release of Priority Question, Premium Members, Team Accounts and Qualified Experts can now identify the emergent level of their issue, signal…
Suggested Courses

850 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question