tags:

views:

96

answers:

3

Hi,

I have a user control in the modules folder of my project. and I have a link like Test in this control. When ever I mouseover this "Test" on the page, I can see the whole url like this "www.example.com\projectName\Modules". But I want to make it such a way that it should display the url as "www.example.com\projectName". I want to get rid of that modules folder name.

A: 
jessegavin
I am trying to do like this<a href='<%=Request.ApplicationPath%>'>Test</a><a href='<%=Request.RawUrl%>'>Test</a><a href='<%=Request.PhysicalPath%>'>Test</a>But none of theese giving the right path
sathish
As you solution make it to work on my dev site, but if I take it to live I have only one absolute url. no project name nothing in it. So I want to make it to work on for both domainsThanks
sathish
my dev site url is www.abc.com\ApplicationNamelive site url is www.xyz.comSo make that url to work for both of them
sathish
If you start the URL with a /, it will use whatever the current domain name is.
jessegavin
+2  A: 

I am assuming here you want to change the hover text that appears in the status bar?

To do some you could use the following inline script to do so:

<a href="http://www.google.com/somegarbage"
    onmouseover="window.status='http://www.google.com'; return true"
    onmouseout="window.status=''">Google</a>

This would produce a link with the text Google and when you hover over it the status bar text would show as http://www.google.com instead of the actual url which is http://www.google.com/somegarbage.

You can just change the code above to inject whatever you want by replacing the text being assigned in the onmouseover event.

Kelsey
Actually I found the solution Iam using like this<a href='<%# Page.ResolveUrl("~")%>' runat="server"></a>This is giving me the url correctly as I needed.Thanks for help
sathish
I think you can get by without using the Page.ResolveUrl(). Try <a href="~/" runat="server">
uhleeka
A: 

If you can set your <a> to runat server, you can do:

<a href="~/" runat="server">Test</a>
uhleeka