如何像Blogger.com动态创建这种类型的子域 [英] How to create this type of subdomain on the fly like Blogger.com

查看:215
本文介绍了如何像Blogger.com动态创建这种类型的子域的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

一个前某个时候,我问这个问题,我被告知,该条目在DNS等来进行,我不知道whather这一切是真的需要与否。那种功能的,我希望在下面的截图所示:

A sometime ago I asked this question and I was told that the entry has to be made in DNS etc. I was not sure whather all this is really required or not. The kind of feature that I am looking for is shown in the screenshot below:

正如你所看到的博客允许用户选择自己的博客子域。我们怎样才能做到这一点?我基本上在asp.net C#开发。我怎样才能让我的用户选择这样的子域名一旦我有我的顶级域名。目前,我正在开发本地主机上。

As you can see blogger lets the user choose the subdomain for his blog. How can we achieve this? I am basically developing in asp.net C#. How can I allow my users to choose subdomains like this once I have my top level domain. Currently I am developing on localhost.

在此先感谢:)

推荐答案

所以它捕获每个请求的顶级域名下使用IIS通配符域。

Use a wild card domain in IIS so it traps every request to the top level domain and under.

asp.net :创建一个HttpModule ...这将运行每一个请求,你可以检查网域名称等,并基于子域的用户信息拉。一个例子的HttpModule可以的 URL通过HTTP模块在ASP.NET重写。

In asp.net: Create an HttpModule... this will run for every request and you can check the domain name, etc and pull in user information based on the sub-domain. An example httpmodule can be found at URL Rewriting in ASP.NET via HttpModule.

asp.net MVC :创建自定义RouteHandler(基于自定义接口IRouteHandler)。看看 RouteHandler VS的ControllerFactory 一个例子问题。

In asp.net mvc: Create a custom RouteHandler (custom based on interface IRouteHandler). Look at RouteHandler vs ControllerFactory question for an example.

这篇关于如何像Blogger.com动态创建这种类型的子域的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆