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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T11:17:46+00:00 2026-05-26T11:17:46+00:00

I’ve got an ASP.NET MVC 3 web application that lives on server 1: http://www.mysite.com

  • 0

I’ve got an ASP.NET MVC 3 web application that lives on server 1:

http://www.mysite.com

And i’ve got a widget (also ASP.NET MVC 3 web application) that lives on server 2:

http://widget.www.mysite.com

Now, i want to generate a link to the main website from my widget.

So if i do something like this in the widget project:

@Html.RouteLink("Outbound link", "MainWebsiteRoute", "http", "http://www.mysite.com", string.Empty, null)

It will error (or generate the wrong link) because the route tables are different between the widget and website project.

Even if i copy the route from the main website into the widget one, the controllers/actions don’t exist in the widget project, so it won’t work.

How do i do it? Do i have to hardcode the URL’s?

  • 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-05-26T11:17:46+00:00Added an answer on May 26, 2026 at 11:17 am

    Ended up duping the routes from the main website that i need in the widget.

    Example route in main website:

    context.MapRoute(
       "Q&A - Individual Q",
       "{locationUniqueUri}/questions/{questionUniqueUri}",
       new { controller = "Questions", action = "Detail" },
    );
    

    Duped route in widget:

    RouteTable.Routes.MapRoute(
       "Outbound - Q&A - Individual Q",
       "{locationUniqueUri}/questions/{questionUniqueUri}"
    );
    

    Notice how there are no route defaults – that’s because i don’t care, since that’s concerning matching the route to a controller/action. But this happens in the website, not the widget. All i’m concerned about is generating the URL.

    I then created a simple wrapper for RouteLink called OutboundRouteLink which specifies the hostname (for the main website), and generates the link.

    I don’t think it’s too bad a solution. Obviously, it’s hard-coded in a way – if the routes change in the main website then i’ll have to change the widget routes. But that fine, because if one of my URL’s changed, i’d have to do 301’s anyway, so the old URL’s would still work for the widget (they would get 301’d).

    Also, i could go one step further and store the route url in a config file and share that between the projects, which would give me a bit more safety. But there’s only around 3 outbound URL’s so this should be fine.

    Not saying this is the best way to handle it, but im happy with it.

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

Sidebar

Related Questions

That's pretty much it. I'm using Nokogiri to scrape a web page what has
I've got a string that has curly quotes in it. I'd like to replace
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
link Im having trouble converting the html entites into html characters, (&# 8217;) i
Seemingly simple, but I cannot find anything relevant on the web. What is the
I have a French site that I want to parse, but am running into
i got an object with contents of html markup in it, for example: string
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I have an MVC Razor view @{ ViewBag.Title = Index; var c = (char)146;

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.