URL重写ASP.Net中的子域

时间:2012-07-26 02:47:58

标签: asp.net url-rewriting

如何为此网址制作网址重写规则: example.com/account/login.aspx

到这个网址: me.example.com/login

因此,对文件夹/帐户的任何请求都将重写为me.example.com。此外,子文件夹和文件(如/account/subfoler/file1.aspx)将重写为me.example.com/subfolder/file1

我已经将DNS通配符设置为应用程序,所有子域将采用相同的IP地址。我需要的只是网址重写规则。

1 个答案:

答案 0 :(得分:0)

您可以在IIS 7.0 Url Rewrite

中实现此目的

OR

编写自己的处理程序以拦截传入的请求

要实现这一点,您可以实现IHttpHandler并在ProcessRequest方法中处理url重定向逻辑

这是一个很好的例子http://www.codeproject.com/Articles/30907/The-Two-Interceptors-HttpModule-and-HttpHandlers