2011-07-14 56 views
0

我正在构建需要几个子域的此asp.net应用程序。使用以下重写规则在IIS 7.0上使用子域名重写问题,在IIS 7.5上不存在

admin.domain.com -> domain.com/admin 
user.domain.com -> domain.com/user 
... 

一切都在我的dev的盒子的伟大工程(WIN7,IIS 7.5):他们都将共享相同的代码库,但我在自己的子文件夹中的每个子域独立的.aspx,如下:

<rule name="admin.domain.com" stopProcessing="true"> 
    <match url=".*" /> 
     <conditions> 
     <add input="{HTTP_HOST}" pattern="^admin.domain.com$" /> 
     <add input="{PATH_INFO}" pattern="^/images/" negate="true" /> 
     <add input="{PATH_INFO}" pattern="^/handlers/" negate="true" /> 
     <add input="{PATH_INFO}" pattern="^/aspnet_client/" negate="true" /> 
     <add input="{PATH_INFO}" pattern="^/webservices/" negate="true" /> 
     <add input="{URL}" pattern="\.axd$" negate="true" /> 
     </conditions> 
     <action type="Rewrite" url="\admin\{R:0}" /> 
</rule> 

当我将我的版本推到运行Win 2008 R1的产品上时,在IIS 7.0上重写了中断。我看到页面源代码中的<form>标记指向action="admin/",而在7.5上指向根。所以当我发布我的表单时,我得到了404s,因为每个重写都没有/ admin子文件夹。

有什么我可以做的,以弥补这一点?我想省略升级到R2只是为了解决这个问题。我可以单独升级URL重写模块吗?我可以使用不同的重写规则修复此问题吗?

任何帮助表示赞赏!

回答

0

我发现了一个解决方案,出于某种原因在iis 7.0上,您必须在定义好表格的情况下添加以下内容。在我的情况下,它是我的母版页中的Page_Load。希望这可以帮助。

form1.Action = Request.RawUrl