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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T09:51:36+00:00 2026-06-17T09:51:36+00:00

In my webapp (work in progress) I now try to allow new customers register

  • 0

In my webapp (work in progress) I now try to allow new customers register to my webapp. I am deploying in Azure btw.

The idea I am working on:

http://www.[mysite].com/Register

This register page allows the “new” user to register his a new tenant.

customer.[mysite].com/Register

This pretty much looks as follows in code

    public ActionResult Register()
    {
        var url = Request.ServerVariables["HTTP_HOST"];
        var tenantNameParser = new TenantNameParser(url);

        if (!TenantRepository.Exists(tenantNameParser.TenantName))
        {
            return RedirectToAction("NewCustomer");
        }

        return View();
    }

In the above snippet I check if tenant exists, if not, redirect to new customer.

    [HttpPost]
    public ActionResult NewCustomer(Customer model)
    {
        if (ModelState.IsValid)
        {
            var tenant = new Tenant
                {
                    Name = model.TenantName,
                    Guid = Guid.NewGuid().ToString()
                };

            TenantRepository.Add(tenant);
            // TODO create a new user new tenant repository to do this stuff as 1 atomic action

            if (!UserRepository.Exists(model.AccountableEmailAddress))
            {
                // Attempt to register the user
                var createStatus = MembershipService.CreateUser(
                    model.AccountableUser,
                    model.Password,
                    model.AccountableEmailAddress);

                if (createStatus == MembershipCreateStatus.Success)
                {
                    FormsService.SignIn(model.AccountableUser, false);
                    return RedirectToAction("Index", "Home");
                }

                throw new Exception("crappy implemenation, improve");
            }
            FormsService.SignIn(model.AccountableUser, false);

            // TODO figure out how to redirect to tenant.site.com
            return RedirectToAction("Index", "Home");
        }

        return View(model);
    }

The code above creates a new customer, and in the end my //todo is what this question is about. How to redirect to an URL that includes the actual tenant in the form of tenant.domain.com?

I don’t know if this “way of handling tenants” is a bad practice, if so please feel free to say so.

Question: How to redirect to a tenant URL ([tenantname.[mysite].com/Index/Home). Something like:
Redirect(“tenantname”, “Index”, “Home”) would be great, but of course doesn’t exist. I google’d it for a bit, but didn’t run into helpful links (that’s mainly the reason why I think I am designing “the wrong thing”).

Advice would be awesome! Thx a lot for your considerations in advance!

If I need to rephrase stuff because it’s unclear what I ask for then please let me know.

  • 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-17T09:51:37+00:00Added an answer on June 17, 2026 at 9:51 am

    Just my 2 cents, please correct me if it’s wrong.

    My understanding is, you cannot control the tenant name in [tenant name].yoursite.com in your code, as it’s out of the scope of ASP.NET MVC. It’s a CNAME of the domain yoursite.com. So some thoughts from my end below.

    1. I guess you need a program-able domain provider, which means you can create CNAME from your code. Then when a new customer registered, the actual URL might be yoursite.com/[tenant name]/. Then you map it to a new CNAME [tenant name].yoursite.com.

    2. I’m not sure an URL Rewrite can help you. Which means you create a new rule and if the incoming URL was [tenant name].yoursite.com, you map it to yoursite.com/[tenant name]/

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

Sidebar

Related Questions

I'm currently working on a small webapp where I work. I've created this for
When I try to use custom taglibs in my webapp it doesn't work on
I'm on the cusp of starting work on a new webapp. Part of this
I am basically a newbie whose starting work on a new webapp. The webapp
I have a working webapp based on Python, Flask. (configured to work on http://
I am trying to work with CSS Sprites for my webapp. Here is my
I am developing a Spring MVC 3.0.4 webapp and Logger factroy doesn't work for
As per an user-request I'm trying to make my (PhoneGap) webapp work better with
I've never programmed before, but needed to write a very simple webapp for work.
I have a webapp I've installed on tomcat6 and it doesn't work properly (jwebsocket-1.0

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.