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 8056261
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T08:39:13+00:00 2026-06-05T08:39:13+00:00

I have a page where I want to include a Home link which takes

  • 0

I have a page where I want to include a “Home” link which takes me to my application’s base URL. So far the simplest way I managed to achieve this is through the following line of Razor code, but it’s not pretty and I’m not terribly confident about it:

@Html.RouteLink(MyResources.HomeLinkLabel, new { controller = "" })

Note that if I don’t include controller = "" then the hyperlink it generates takes me to the current page, not my base URL.

I feel I’m missing something obvious… What’s the correct way of doing this?

  • 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-05T08:39:15+00:00Added an answer on June 5, 2026 at 8:39 am

    You could use the following code to get the root URL

    Url.Content("~/");
    

    The server-side ~/ syntax references the root of your application (meaning it will take into account if your app is registered in a virtual path in IIS).

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

Sidebar

Related Questions

I have my index.php page and just afrer my header i want to include
I want to hide some of the categories from magento home page. I have
I have 2 'libraries' which I need to include on the same page. Simple
I have a home page where I want to display a div in a
I have a Asp.net MVC 2 project. My start page has following link: http://localhost:2666/Home/Index?SomeID=4f62c452-4513-4dd0-b235-830d721815e4
I have a page that I want to update non stop, every few seconds.
I have a page that I want to be styled differently depending on whether
I have an html page i want to print a portion of this html
I have a search page and want to add some filters to it, my
I want to have a page redirect to another. Here is the situation: I

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.