Asp.net 将子域url替换为同一域上不同url的IIS重写规则
仅当下面的url包含'/reports'时,我才想匹配模式。如果是,则下面的url:Asp.net 将子域url替换为同一域上不同url的IIS重写规则,asp.net,iis,url-rewriting,Asp.net,Iis,Url Rewriting,仅当下面的url包含'/reports'时,我才想匹配模式。如果是,则下面的url: 应仅替换为子域,如: 无需更改额外参数或页面名称。 此url内容可以是动态的,这是我们无法修复的硬编码规则:reports/abc/sample.PDF使用全局上的BeginRequest,尽快检查您的请求路径,并根据您的问题采取行动-这是一个示例 protected void Application_BeginRequest(Object sender, EventArgs e) { HttpAp
应仅替换为子域,如:
无需更改额外参数或页面名称。
此url内容可以是动态的,这是我们无法修复的硬编码规则:reports/abc/sample.PDF使用全局上的BeginRequest,尽快检查您的请求路径,并根据您的问题采取行动-这是一个示例
protected void Application_BeginRequest(Object sender, EventArgs e)
{
HttpApplication app = (HttpApplication)sender;
string cTheFile = HttpContext.Current.Request.Path;
if (cTheFile.Contains("/reports/") && cTheFile.Contains("https://test."))
{
app.Response.Redirect(Request.RawUrl.Replace("https://test.","https://test2."), true);
return;
}
}
注意避免任何无休止的循环