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

  • Home
  • SEARCH
  • 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 8185589
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T01:54:07+00:00 2026-06-07T01:54:07+00:00

I have an old web app developed in ASP.Net with the old type code

  • 0

I have an old web app developed in ASP.Net with the old type code behind style. I am eventually going to re-do the complete web app in ASP.Net MVC 3 – just starting to complete the first sections and integrate them. I am having some problems with a menu that appears along the top. So there is a home button it looks like the below in code:

onclick='document.location.href=\"Home.aspx\"'>

However I am getting the url in the new mvc part of web were I have the menu and i try to hit the home icon I get a page not found:

/MyWeb.Web.App/mvc/Controller/Home.aspx

The actual home aspx page exists in the location \MyWeb.Web.App\mvc\Home.aspx

I am currently stumped as to what I can edit in the JS href to get it to point to this location so the icons will work in the existing implementation and the new MVC one.

Thanks.

  • 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-07T01:54:08+00:00Added an answer on June 7, 2026 at 1:54 am

    Use urls helpers. For example if you are using Razor and this code is inside an MVC view:

    onclick='document.location.href="@Url.Content("~/mvc/home.aspx")"'>
    

    or if you are using the WebForms view engine:

    onclick='document.location.href="<%= Url.Content("~/mvc/home.aspx") %>"'>
    

    UPDATE:

    If this is in a separate javascript file then you could declare a global variable inside your Razor view that will point to the base url:

    <script type="text/javascript">
        var baseUrl = '@Url.Content("~/mvc")';
    </script>
    

    and then inside your javascript file:

    onclick='document.location.href=\"" + baseUrl + "/home.aspx\"'
    

    There are of course much better ways to achieve that but since you haven’t provided enough details about your scenario it’s difficult to suggest what might be best. For example you could use HTML5 data-* attributes in your DOM or some other elements to generate properly this url and access it in your javascript file.

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

Sidebar

Related Questions

I have a ASP.Net 3.5 web site I developed on my old XP sp3
I have an old ASP.NET web application on a server, which was developed in
We have an old web app written in classic ASP. We don't have the
I have in here an old web application written in ASP.Net 2.0 + AJAX.
Age old question! When you have finished developing and testing your ASP.Net web application,
For some strange reason, a five year old internal asp.net web app that is
I have an ASP.NET web forms app with a button on it. This button
I have several horrors of old ASP web applications. Does anyone have any easy
Scenario: old legacy code in rpg have to consume data from a new web
We currently have a 10 year old nasty, spaghetti-code-style SQL Server database that we

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.