asp:hyperlink - NavigateURL is always relative. I need absolute.

Discussion in 'ASP .Net Web Controls' started by Carl Grainger, Sep 24, 2006.

  1. Hi, When progammatically setting the navigateURL property in code behind, the
    URL is always rendered as relative i.e it's appended to the applications root
    URL. If I use the same string and hard code it the URL is rendered correctly
    as absolute.

    Can anyone tell me how to set an abolute URL in code behind. I'm using
    ASP.NET 2.0/VB/VS 2005. The URL I'm passing is "http://www.mywebsite.com/"
    etc.

    Appreciate any help - faster the better. More info if required. Regards Carl
    Grainger
    Carl Grainger, Sep 24, 2006
    #1
    1. Advertising

  2. Sorted after some trial and error: I was using stringbuilder.append and then
    toString to build the navigateURL. I was then using server.URLencodie to
    remove spaces in one of the querystrings etc. I didn't know that the
    stringbuilder was already doing this step for me. By using both the
    navigateURL was appended to the application root. Hope this helps someone
    else.

    "Carl Grainger" wrote:

    > Hi, When progammatically setting the navigateURL property in code behind, the
    > URL is always rendered as relative i.e it's appended to the applications root
    > URL. If I use the same string and hard code it the URL is rendered correctly
    > as absolute.
    >
    > Can anyone tell me how to set an abolute URL in code behind. I'm using
    > ASP.NET 2.0/VB/VS 2005. The URL I'm passing is "http://www.mywebsite.com/"
    > etc.
    >
    > Appreciate any help - faster the better. More info if required. Regards Carl
    > Grainger
    >
    Carl Grainger, Sep 25, 2006
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Amir Eshterayeh
    Replies:
    5
    Views:
    9,317
    Sobot
    Feb 13, 2009
  2. Nathan Sokalski
    Replies:
    0
    Views:
    716
    Nathan Sokalski
    May 30, 2005
  3. gerry

    asp:Hyperlink NavigateUrl problem

    gerry, Jan 18, 2006, in forum: ASP .Net
    Replies:
    3
    Views:
    8,584
    Sobot
    Feb 13, 2009
  4. =?Utf-8?B?Um9u?=

    NavigateUrl mailto relative URi error

    =?Utf-8?B?Um9u?=, Sep 19, 2006, in forum: ASP .Net
    Replies:
    2
    Views:
    2,560
    =?Utf-8?B?Um9u?=
    Sep 20, 2006
  5. Nathan Sokalski
    Replies:
    0
    Views:
    180
    Nathan Sokalski
    May 30, 2005
Loading...

Share This Page