Skip to content

Uncategorized

How to Point Multiple Domains to a Single IIS ASP.net WebForms Project

Introduction In this blog post, we’ll explore how to configure IIS to point multiple domains to a single WebForms project. This setup is useful for businesses or websites that want to host multiple websites under different domains, but all should point to the same web application or project in…

· Updated 3 min read

Introduction

In this blog post, we’ll explore how to configure IIS to point multiple domains to a single WebForms project. This setup is useful for businesses or websites that want to host multiple websites under different domains, but all should point to the same web application or project in IIS.

For example, you may want to serve example1.com and example2.com from the same project running on your IIS web server, but each domain should behave as if it is a separate website.

Understanding IIS Bindings

In IIS, bindings define how a domain points to your site. You can have multiple bindings (e.g., HTTP, HTTPS) for a single site, allowing different domains to point to the same web application.

Now lets get into the steps! Go.

Add a New Binding for Each Domain

  • In IIS Manager, navigate to your WebForms project in the left panel under Sites.

  • Right-click on your website, and select Edit Bindings.
  • In the Site Bindings window, click Add to add a new binding for each domain.
  • Type: Select http (or https if using SSL).
  • IP address: Select All Unassigned (or a specific IP address, if applicable).
  • Port: Typically 80 for HTTP and 443 for HTTPS.
  • Host name: Enter the domain name (e.g., example1.com).

Repeat the process for each domain you want to point to the same project (e.g., example2.com).

Configuring DNS for Multiple Domains

To ensure your domains point to your IIS server, you need to configure DNS records for each domain. (this is a prerequisite and this article assumes the pointing has been done already)

Handling Multiple Domains

Now that multiple domains are pointing to the same IIS project, you might want to ensure that your WebForms application can differentiate between these domains. You can achieve this by inspecting the Request.Url in the WebForms project.

 protected void Application_BeginRequest(object sender, EventArgs e)
{
string currentDomain = Request.Url.Host.ToLower();

if (currentDomain == "example1.com") { // Perform actions specific to example1.com } else if (currentDomain == "example2.com") { // Perform actions specific to example2.com } else { // Handle other domains or set a default } }

What if I need a different theme layout?

You can define specific master pages or CSS files based on the domain. For example, in Application_BeginRequest, you could modify the master page or theme:

 if (currentDomain == "example1.com")
{
    MasterPageFile = "~/MasterPages/Example1Master.master";
}
else if (currentDomain == "example2.com")
{
    MasterPageFile = "~/MasterPages/Example2Master.master";
}

Testing the Setup

Once all configurations are completed, it’s time to test:

  1. Open your browser and visit each domain (e.g., http://example1.com and [http://example2.com](http://example2.com)./))../)
  2. Verify that each domain points to the same WebForms project and the expected content is served.
  3. If you’ve implemented domain-specific routing or theming, confirm that it works as expected for each domain.

Hooray!!! Now you have achieved multi domain pointing..

Conclusion

In this blog post, we’ve covered how to point multiple domains to a single IIS WebForms project. This is a common scenario for businesses that want to serve different websites or brands using a single server. By setting up proper IIS bindings, DNS records, and handling domain-specific logic in your WebForms project, you can efficiently manage multiple domains with a single codebase.

Comments

  • Uncategorized

    Institutional Software Customization: Tailoring Solutions for Your Institution’s Needs

    Introduction: Welcome to the era of customization, where one size doesn’t fit all. In this comprehensive guide, we delve into the intricate world of institutional software customization, unraveling its importance, benefits, and the transformative power it holds for educational and organizational…

    Read article

    Abhilash Sivaraman · 13 Mar 2025 · 3 min read

  • Uncategorized

    Setting Up PHP Laravel on Windows Server with IIS

    Deploying a PHP Laravel application on a Windows Server with IIS involves several steps to ensure the web server handles PHP requests correctly. Here’s a step-by-step guide to get you started with setting up PHP and Laravel on IIS. Step 1: Download PHP for Windows First, download the latest…

    Read article

    Abhilash Sivaraman · 30 Nov 2024 · 3 min read

  • Uncategorized

    Creating a Customer Loyalty Program in Shopify: A Step-By-Step Guide

    Customer loyalty is the difference between success and failure in the cutthroat world of online commerce. One-time customers can become devoted brand supporters with the help of a well-designed customer loyalty programme. One of the top e-commerce platforms, Shopify, provides a comprehensive…

    Read article

    Abhilash Sivaraman · 20 Nov 2024 · 2 min read

  • Uncategorized

    List of Best Startups in Kerala

    List of startups kerala Kerala, often termed “God’s Own Country,” is not just a hub of natural beauty but also a growing hotspot for innovative startups. The state is producing inspiring ventures that combine creativity with technology, driving India’s entrepreneurial spirit forward. Here is a…

    Read article

    Abhilash Sivaraman · 15 Oct 2024 · 2 min read

  • Uncategorized

    Wix for blogging how effective is wix compared to other platforms for our content marketing

    Content marketing remains one of the most effective ways to attract, engage, and convert potential customers online. Whether you’re a small business, startup, freelancer, or established brand, maintaining a blog can significantly improve your website’s visibility and authority. When choosing a…

    Read article

    Abhilash Sivaraman · 22 Aug 2024 · 4 min read

  • Uncategorized

    Building Your Own Native Mobile App with Wix

    Mobile apps have become an essential tool for businesses looking to connect with customers and provide a seamless user experience. With Wix, you can create your own native mobile app without extensive coding knowledge. Why Build a Mobile App with Wix? Wix offers an easy-to-use platform that allows…

    Read article

    Abhilash Sivaraman · 26 Jun 2024 · 1 min read

  • Uncategorized

    Comprehensive Analysis of Leading SMS Gateway Providers in Nigeria

    Top SMS Gateway Providers in Nigeria – In today’s fast-paced digital world, efficient communication is crucial for business success. SMS gateways play a vital role in ensuring that businesses can reach their customers quickly and reliably. In Nigeria, the demand for robust SMS gateway providers…

    Read article

    Abhilash Sivaraman · 1 Feb 2024 · 5 min read

Have a project in mind?

Book a free intro call and let’s talk about your website or web app.