Asp.net处理.CFM文件或重定向从.cfm到.aspx页面? [英] Asp.net processing of .CFM files or Redirects from .cfm to .aspx page?

查看:341
本文介绍了Asp.net处理.CFM文件或重定向从.cfm到.aspx页面?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个旧的.cfm(ColdFusion)页面,用于处理表单数据(来自远程服务器),并根据表单数据向用户发送电子邮件。现在我不再使用ColdFusion,而是托管在免费ASP.NET(3.5)。我不知道我有多少控制。但我想如果我可以有一个global.asax文件,其中所有的请求(实际上,形式的帖子)到.cfm页面被重定向到一个aspx页面,我可以做所需的处理。
如何在共享托管服务提供商的限制内做到这一点?我知道我可以在IIS中创建一个虚拟目录。例如,www.xyz.com/processform.cfm可以定向到www.xyz.com/processform.aspx?

I have a legacy .cfm (ColdFusion) page which used to process form data (from remote servers) and send users emails based on form data. Now I no longer use ColdFusion and instead hosting is at the 'free' ASP.NET (3.5). I am not sure how much control I have over that. But I was thinking if I can have a global.asax file where all requests (actually, form posts) going to the .cfm page get redirected to an aspx page where I can do the needed processing. How can this be done within a shared hosting providers limitations? I know I can create a Virtual Directory in IIS. For example, www.xyz.com/processform.cfm can be directed to www.xyz.com/processform.aspx?

推荐答案

Koby Mizrahy接近帮助我。我的问题是,我运行Blog Engine .NET 2.0作为我的网站的主要应用程序在GoDaddy的IIS经典模式。因此.cfm扩展不是由ASP.NET引擎处理的,因此对Web.Config或Global.asax的更改没有帮助。我不得不改成集成模式。这是我做的修复:

Koby Mizrahy was close to helping me. My problem was that I was running Blog Engine .NET 2.0 as the main application of my website in GoDaddy's IIS Classic Mode. So the .cfm extension were not processed by the ASP.NET engine and hence no changes to either Web.Config or Global.asax were helping. I had to change to Integrated mode. Here is what I did to fix:

在Web.Config中,添加到处理程序节点,以确保表单帖子.cfm将被处理,否则我有一个405错误。

In Web.Config, added this in the 'Handlers' node to make sure Form Posts to .cfm would be processed, otherwise I got some 405 error.

 <add name="ColdFusion" path="*.cfm" verb="*" type="System.Web.StaticFileHandler" resourceType="Unspecified" preCondition="integratedMode" />

然后在global.asax中,我在Application_beginrequest处理程序中有这个

Then in global.asax, I had this in the Application_beginrequest handler

if (Request.Url.ToString().Contains("TourEmail-act.cfm"))// 
    {
   Server.Transfer("/360Flash/TourEmail-act.aspx");
   }
 }

问题解决!非常感谢Mizrahy!

Problem solved! Thank you very much Mizrahy!

这篇关于Asp.net处理.CFM文件或重定向从.cfm到.aspx页面?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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