About asp.net core subdomain?

KaaN ErYuRt 0 Reputation points
2023-08-21T07:47:13.4566667+00:00

Hello, I have a web application software with asp.net core 6. This application also has an API. For example, what I want to do is:

web application domain: www.example.com,

I want to access subdomains api.example.com and blog.example.com. For example, when I want to access the blog page through the web application, I want to provide a redirect such as blog.example.com/subject-detail-1 within the same application pool. The API running on the system works with www.example.com/api/.... I want to use it as api.example.com too. Are these possible with asp.net core? Could you please help me how to proceed?

Developer technologies ASP.NET ASP.NET Core
Developer technologies C#
{count} votes

1 answer

Sort by: Most helpful
  1. Bruce (SqlWork.com) 77,686 Reputation points Volunteer Moderator
    2023-08-21T20:57:40.8466667+00:00

    you question is not clear. dns names just return an ipaddress. by default asp.net core does not check the host header (dns name used for request). In IIS the host header binding are at the site level.

    in asp.net core you can write middleware to remap the url based on the host header. google for examples

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.