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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T19:05:02+00:00 2026-05-15T19:05:02+00:00

I find myself in a difficult situation. We’re working on an ASP.NET MVC 2

  • 0

I find myself in a difficult situation. We’re working on an ASP.NET MVC 2 application which is comprised of multiple sections. It is a design goal to have these sections span across several subdomains. Each subdomain will have its own controller.

The challenge is that our hosting provider’s control panel allows two forms of redirection for subdomains, and neither of them seem to fit the bill. The choices are:

  • Redirecting to URL. Choice is given whether to redirect to an exact destination or a destination relative to the request URL.

  • Redirecting to a specific folder in my hosting space.

I’ll try to illustrate the intended behaviour. Assuming the default route is {controller}/{action}/{id}, I’d like the URL http://subdomain.welcome.com/a/b be handled by the MVC Application like http://welcome.com/subdomain/a/b.

The URL redirection could solve this problem, except for the fact that the user sees a URL change occur in the browser. We don’t want the client to see the redirection occur.

Redirecting to our MVC apps root folder doesn’t work at all. The app doesn’t pick up the request and a 4xx error gets passed back by IIS.

edit:

In the interest of finding an answer, I’ll simplify this a bit. The “redirect to URL” doesn’t do what I want so that leaves redirecting to a folder.

If I’m redirecting a subdomain to the root folder of my MVC App and IIS wont pick up the requests, is this a limitation of IIS or my provider?

  • 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-15T19:05:02+00:00Added an answer on May 15, 2026 at 7:05 pm

    Can you make your hosting website host headers respond to *.mydomain.com? Meaning, can your website take request for any sub domain of your primary domain? If so, then reference this post on how to handle subdomain routing in MVC apps and you should be good to go.

    I would update the code in the post to this however, to make the code more succinct. In any case, make sure you have your 404 errors in place for people attempting to go to subdomains that don’t exist.

    public class ExampleRoute : RouteBase
    {
    
        public override RouteData GetRouteData(HttpContextBase httpContext)
        {
            var url = httpContext.Request.Headers["HOST"];
            var index = url.IndexOf(".");
    
            if (index < 0)
                return null;
    
            var subDomain = url.Substring(0, index);
    
                var routeData = new RouteData(this, new MvcRouteHandler());
                routeData.Values.Add("controller", subdomain); //attempts to go to controller action of the subdomain
                routeData.Values.Add("action", "Index"); //Goes to the Index action on the User2Controller
    
                return routeData;
        }
    
        public override VirtualPathData GetVirtualPath(RequestContext requestContext, RouteValueDictionary values)
        {
            //Implement your formating Url formating here
            return null;
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I find myself in the difficult situation of having to debug a Qt application
I have a database which manages login information for an application, and find myself
I find myself choosing between the two following design patterns a lot: static {
I find myself constantly running into a situation where I have a set of
Sometimes I find myself in the situation where I want to execute several sequential
I find myself typing import numpy as np almost every single time I fire
I find myself often having to reposition subviews of a view after hiding or
I find myself creating Converters often and would like to be able to: right-click
I find myself using Resharper's convert to auto property refactoring a lot to remove
I find myself doing this repeatedy. $jq(button).filter(function(){ return this.id.match(/^user_(\d+)_edit$/); }).click(function(){ var matches = this.id.match(/^user_(\d+)_edit$/);

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.