我正在替换现有的Web应用程序,它的所有请求都通过url: www.something.com/scripts/xxx.dll?args
我创建了自己的aspx页面来处理这些请求并调用它: www.something.com/scripts/xxx.aspx?args
我的问题是,有许多现有链接,来自其他网站引用xxx.dll?args网址。
我可以在.net中创建自己的dll,它将接收xxx.dll吗?args请求并处理它们? 这不是一个简单的重定向,因为我还需要args
答案 0 :(得分:1)
我建议改为使用Url Rewriting
答案 1 :(得分:1)
经过一番调查后,我做了以下几点。
更改web.config,通过添加以下代码确保所有请求都通过我的代码:
...<system.webServer>
<modules runAllManagedModulesForAllRequests="true">...
在web项目中添加了一个global.asax文件,并在其中编写了以下代码:
protected void Application_BeginRequest(object sender, EventArgs e)
{
if (Request.Path.EndsWith("xxx.dll",
StringComparison.InvariantCultureIgnoreCase))
Context.RewritePath("/scripts/xxx.aspx");
}