How can I call global.asax on .asp page open

2019-07-04 01:32发布

问题:

Hi on redirecting of catalogsmain.asp I want to call Global.asax file and in that I want to call Application_BeginRequest method.

Actual I have one old website which is created in old ASP so it contains all page with extension .asp. Now we had created that same website in MVC and now what we need to do is that when any user search on google and click to the SEO link it will open that site as www.abc.com/product.asp which will redirect it to IIS 404 error as product.asp page will not be there in our new application. Similiary like this there are around 300 of pages

Is there any other way that when I redirect for OLD URL like www.abc.com/product.asp it automatically gets redirect to as www.abc.com/Product/ProductShow.

I have asked similar question on link where I had written code link

But I did not get any reply.

I had review to this link but I am not getting how he is calling global page on accessing .asp page.

Can any one suggest Some good technique. for how do I redirect to new URL Please review this link where I had asked similar question

Created Rewrite config

In web.config file I had written code as which thinks to be fine

 <system.webServer>
   <rewrite>
   <rules configSource="Rewrite.config" />
 </rewrite>   
 </system.webServer>

回答1:

If it's available to you, you could use the URL Rewrite extension for IIS. See this other question for how the rules are written: If Url not valid, perform legacy url lookup before throwing 404 error