为每个用户创建子域

发布于 2024-08-12 12:22:12 字数 329 浏览 1 评论 0原文

如何在注册期间为网站的每个注册用户创建子域?
对于以下场景...

  1. 用户打开 site.com/register。
  2. 提供详细信息并提交。
  3. 立即重定向到 newuser.site.com
  4. 用户可以在 newuser.site.com 区域工作

我不知道如何解决问题:

  1. 为用户创建和传播子域。
  2. 使用单个 ASP.NET 应用程序来处理所有子域和主域。
  3. IIS 的配置。

理想情况下,我希望尽可能多地使用 .NET Framework。

How is it possible to create a subdomain for each registered user of the web-site during the registration?
For the scenario below...

  1. User opens site.com/register.
  2. Provides details and submits.
  3. Gets redirected to the newuser.site.com straight away
  4. User can work in the newuser.site.com area

I don't know how to solve the issues:

  1. Create and propagate a subdomain for the user.
  2. Have the single ASP.NET application to handle all subdomains and the main domain.
  3. Configuraton of IIS.

Ideally I would like to stay withing .NET Framework as much as possible.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

别把无礼当个性 2024-08-19 12:22:12

您可以这样处理:

  1. 首先,为您站点的 IP 地址建立一个通配符 DNS 域 (*)。这将允许 anystring.yourdomain.com 正确解析。
  2. 将 IIS 配置为绑定到专用 IP 地址,但不依赖主机标头(具有空主机标头)。这将导致对绑定 IP 的所有 HTTP 请求都定向到您的站点。
  3. 有一个 HttpModule 来查看传入域(在 HttpContext 中),如果无效则拒绝它。您可能会考虑设置 cookie 或票证或类似的东西,以避免需要为每个请求进行数据库查找以验证它。

You might approach it like this:

  1. First, establish a wildcard DNS domain (*) for your site's IP address. That will allow anystring.yourdomain.com to resolve correctly.
  2. Configure IIS to bind to a dedicated IP address, but not to rely on host headers (have an empty host header). That will cause all HTTP requests for the bound IP to be directed to your site.
  3. Have an HttpModule that looks at the incoming domain (in HttpContext), and rejects it if it's not valid. You might consider setting a cookie or ticket or something like that, to avoid the need to do a DB lookup for each request in order to validate it.
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文