URLs - relative and the use of ~

Posted on 2012-09-19
Medium Priority
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:


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?
Question by:Lorna70
LVL 18

Accepted Solution

Rajar Ahmed earned 720 total points
ID: 38413669
LVL 25

Assisted Solution

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!


Set up using IIS

Author Comment

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 :-().

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