我如何在.asp页打开时调用global.asax [英] How can I call global.asax on .asp page open

查看:65
本文介绍了我如何在.asp页打开时调用global.asax的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,在重定向catalogsmain.asp时,我想调用Global.asax文件,并且在其中我想调用Application_BeginRequest方法.

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

实际上,我有一个用旧ASP创建的旧网站,因此它包含所有扩展名为.asp的页面. 现在我们已经在MVC中创建了相同的网站,现在我们需要做的是,当任何用户在google上搜索并单击到SEO链接时,它将以www.abc.com/product.asp打开该网站,并将其重定向到IIS 404错误,因为product.asp页不会出现在我们的新应用程序中.这样的类似词大约有300页

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

还有其他方法,当我重定向到旧网址(例如www.abc.com/product.asp)时,它会自动重定向到www.abc.com/Product/ProductShow.

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.

我已对此链接进行了审查,但在访问.asp页面时,我不知道他如何调用全局页面.

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

任何人都可以提出一些好的技巧吗?有关如何重定向到新URL 请查看此链接我曾问过类似问题的地方

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

创建的重写配置

在web.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>

推荐答案

如果您可以使用它,则可以使用用于IIS的URL重写扩展名.有关规则的编写方式,请参见另一个问题: 如果网址无效,在抛出404错误之前执行旧版网址查找

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

这篇关于我如何在.asp页打开时调用global.asax的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆