I'm just new to creating and launching web sites and i've hit a stumbling block.
I have a hosting account with 3 different domains assigned to it. Each domain is mapped to a section of the main directory. So it goes like this:
My Site -
-Site1
-Site2
-Site3
However i can't seem to use the same URLs which work locally on the hosted site and vice versa. This is an example of the code i use in a link:
<asp:MenuItem NavigateUrl="/Default.aspx" Text="Home"/>
This works fine when uploaded to the host, but locally i get an error:
HTTP Error 404 - Not Found.
And when i leave off the /
<asp:MenuItem NavigateUrl="About.aspx" Text="About"/>
It will work locally but i will get an error when hosted:
Resource cannot be found:
Requested URL: /Site1/Site1/About.aspx
I've used ~, ../, default.aspx etc and it'll always work on one, but not the other. I'm sure im missing something dead simple but just can't work it out.
Try this
<asp:MenuItem NavigateUrl="/ProgectName/About.aspx" Text="About"/>
Or ServerSide
Menu1.Items.Add(new MenuItem { NavigateUrl = Page.ResolveUrl("About.aspx"), Text = "About"});