Absolute reference

J

John

Hi

How can I set an absolute reference to site root in a page link so the
referenced page is always accessed from the site root folder?

Thanks

Regards
 
?

=?ISO-8859-1?Q?G=F6ran_Andersson?=

John said:
Hi

How can I set an absolute reference to site root in a page link so the
referenced page is always accessed from the site root folder?

Thanks

Regards

You can use the "~" root operator:

<a href="~/Default.aspx" runat="server">Home</a>
 
G

Guest

Use ASP.NET server controls (e.g, Hyperlink). You can set the NavigatUrl to
something like "~/myfolder/myresource.aspx". The tilde (~) always will
resolve relative to to root of the web site.
Peter
 
G

Guest

Hi John,

In addition to Peter's and Goran's replies, every descandant that derives
from Control class has ResolveUrl() that converts a URL into one that is
usable on the requesting client.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,997
Messages
2,570,239
Members
46,827
Latest member
DMUK_Beginner

Latest Threads

Top