using dll extention instead of the standard aspx
I am replacing an existing web application, that all it's requests go through a url: www.something.com/scripts/xxx.dll?args
I created my own aspx page that handles these requests and it is called: www.something.com/scripts/xxx.aspx?args
My problem is that there are many existing links, from other website that refer to the xxx.dll?args url.
Can I create m开发者_如何学运维y own dll in .net that will receive the xxx.dll?args requests and process them? This isn't a simple redirect, because I also need the args
I'd suggest to rather use Url Rewriting
After some more investigation I did the following.
Change the web.config, to make sure all requests go through my code by adding the following code:
...<system.webServer>
<modules runAllManagedModulesForAllRequests="true">...
Added a global.asax file to the web project, and within it wrote the following code:
protected void Application_BeginRequest(object sender, EventArgs e)
{
if (Request.Path.EndsWith("xxx.dll",
StringComparison.InvariantCultureIgnoreCase))
Context.RewritePath("/scripts/xxx.aspx");
}
精彩评论