Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7889203
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T06:02:16+00:00 2026-06-03T06:02:16+00:00

I have some text which is loaded from a resource file. Ordinarily, to get

  • 0

I have some text which is loaded from a resource file. Ordinarily, to get dynamic content I would use:

string.Format(GetLocalResourceObject("SomeText"), PhoneNumberAsString) 

I want to do the same with a link, only the link needs to be application relative as I have URLs like mysite.com/page.aspx and mysite.com/fr/page.aspx.

I normally use an <asp:HyperLink /> tag to create the links as I can then just put a squiggle at the start NavigateUrl="~/page.aspx". However, I don’t know of a way to get a dynamic HyperLink to appear as a string without adding it as a control to something.

Simply writing ToString() outputs System.Web.UI.WebControls.HyperLink..

How do I get a link out of a resource file and make it into a hyperlink using ASP.NET Webforms?

UPDATE

With some help from the answers I now have the following code on my page:

<p><%= string.Format(GetGlobalResourceObject("Resource", "MoreThan1000Users").ToString(), ResolveUrl("~/contact-us.aspx")) %></p>

and in my resource file I have:

If you would like more than 1000 users please <a href="{0}">call our sales team</a>.

Does this seem like good practice or is there another way to achieve what I’m doing? I don’t know if I should be happy or not that there is HTML inside the resource file.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T06:02:18+00:00Added an answer on June 3, 2026 at 6:02 am

    Since you haven’t posted code, I’m guessing somewhere you have a HyperLink WebControl object that you’re hitting ToString() on. If that’s the case, you can access the URL associated with it using its myHyperLinkControl.NavigateUrl property.

    If you’re storing the link in your resource with a squiggle/tilde (which is good) then you can replace the squiggle with your application location. If you have a control/page, then you can easily call its ResolveURL method (which takes the tilde and automatically replaces it) There’s some existing solutions if you don’t have a control/page reference with your context, then there’s some discussion to do that here: ResolveUrl without an ASP.NET Page

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a script which collects an image, link and some text content from
I have a data structure object which is loaded from an XML file inside
I want to truncate some text (loaded from a database or text file), but
I have some text loaded into NSString objects which contains annotations in square brackets
I have a edittext in which some text are selected . I want to
I have a JeditorPane which has some text in HTML format. When I execute
I have a div which has some text, but according to different situations this
I have some xml files that contain text, which are displayed on my website.
Story: I have a link which has some text. A part of the link
I have a custom UITableViewCell which has an image & and some text. When

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.