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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T05:48:29+00:00 2026-05-11T05:48:29+00:00

I am having problems with thinking up a solution for the following. I got

  • 0

I am having problems with thinking up a solution for the following. I got a blog which I recently upgraded from web forms to MVC. The blog is avalible in both swedish and english on two different domains and are running in the same web site in IIS.

The problem is that I would like language specific urls on the both sites, like this:

English: http://codeodyssey.com/archive/2009/1/15/code-odyssey-the-next-chapter

Swedish: http://codeodyssey.se/arkiv/2009/1/15/code-odyssey-nasta-kapitel

At the moment I have made this to work by registering the RouteTable on each request depending on which domain is called. My Global.asax Looks something like this (not the whole code):

public static void RegisterRoutes(RouteCollection routes) {     routes.IgnoreRoute('{resource}.axd/{*pathInfo}');      string archiveRoute = 'archive';      if (Thread.CurrentThread.CurrentUICulture.ToString() == 'sv-SE')     {         archiveRoute = 'arkiv';     }      routes.MapRoute(         'BlogPost',         archiveRoute+'/{year}/{month}/{day}/{slug}',         new { controller = 'Blog', action = 'ArchiveBySlug' }         );      routes.MapRoute(         'Default',                                              // Route name         '{controller}/{action}/{id}',                           // URL with parameters         new { controller = 'Home', action = 'Index', id = '' }  // Parameter defaults     );      routes.MapRoute(         '404-PageNotFound',         '{*url}',         new { controller = 'Error', action = 'ResourceNotFound' }     );  }  void Application_BeginRequest(object sender, EventArgs e) {      //Check whcih domian the request is made for, and store the Culture     string currentCulture = HttpContext.Current.Request.Url.ToString().IndexOf('codeodyssey.se') != -1 ? 'sv-SE' : 'en-GB';      Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture(currentCulture);     Thread.CurrentThread.CurrentUICulture = new CultureInfo(currentCulture);      RouteTable.Routes.Clear();      RegisterRoutes(RouteTable.Routes);      Bootstrapper.ConfigureStructureMap();      ControllerBuilder.Current.SetControllerFactory(         new CodeOdyssey.Web.Controllers.StructureMapControllerFactory()         ); }  protected void Application_Start() {  } 

This works at the moment but I know it not a great solution. I have been getting a ‘Item has already been added. Key in dictionary’ error when stating up this app and it does not seems stable at times.

I would like to only set up my routes in the Application_Start as they should and not having to clear them on every request like I am doing now. Problem is that the request object does not exist and I have no way of knowing which of the language specific routes I should register.

Been reading about the AppDomain but could not find many examples on how to use it on a web site. I’we been thinking to star something like this:

protected void Application_Start() {    AppDomain.CreateDomain('codeodyssey.se');    AppDomain.CreateDomain('codeodyssey.com'); } 

Then registring each web sites routes in each app domain and send the requests to one of them based on the url. Can’t find any examples on how to work with AppDomains in this manner.

Am I completely off track? Or is there a better solution for 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. 2026-05-11T05:48:30+00:00Added an answer on May 11, 2026 at 5:48 am

    The ASP.Net runtime manages AppDomains for you, so its probably not a good idea to create AppDomains in your code.

    However, if you can, I would suggest creating multiple IIS Applications (one for http://codeodyssey.com and one for http://codeodyssey.se). Point both applications at the same directory on disk. This will give you the two AppDomains you are looking for.

    Then, in your Application_Start code, you can check the domain and build routes accordingly.

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

Sidebar

Ask A Question

Stats

  • Questions 95k
  • Answers 95k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer I believe that telerik's Rad Editor supports the ability to… May 11, 2026 at 6:56 pm
  • Editorial Team
    Editorial Team added an answer I can't read minds, but it sounds like you may… May 11, 2026 at 6:56 pm
  • Editorial Team
    Editorial Team added an answer I don't even want to think about how many hours… May 11, 2026 at 6:56 pm

Related Questions

I am working on a group senior project for my university and I have
I had a webmethod working which returned a byte array to the caller: public
I want to be able to spec out that when Open-Uri open() calls either
I've just found out about Stack Overflow and I'm just checking if there are

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.