[英]Response.Redirect in a COM+ Object Called from Classic ASP Page
Basically we moved from IIS 5 to IIS 7 and I am trying to update some of our old COM objects to .NET by rewriting them in C#. 基本上,我们从IIS 5迁移到了IIS 7,我试图通过用C#重写它们将一些旧的COM对象更新为.NET。 What I am have so far is a Classic ASP page calling the COM+ object and then I am trying to do a simple redirect within the COM+ object (this is just for testing purposes, it's not what the object will do eventually).
到目前为止,我所拥有的是一个经典的ASP页,该页调用了COM +对象,然后我试图在COM +对象内进行简单的重定向(这仅是出于测试目的,而不是对象最终将要执行的操作)。
My problem/question is, why does the redirect call not work properly? 我的问题/问题是,为什么重定向调用无法正常工作? Am I doing something wrong or can you not redirect within a COM+ object?
我是在做错什么,还是不能在COM +对象中重定向? All that happens is a blank white page comes up and if I check the IIS logs, I see no errors.
发生的一切都是空白的空白页,如果我检查IIS日志,则看不到任何错误。
Here is my code so far: 到目前为止,这是我的代码:
In Classic ASP (the call to COM+) 在经典ASP中(对COM +的调用)
Set oBankReg = CreateObject("BVSRegistration.SignIn")
oBankReg.GetBankId(bankid)
Code in C# COM object: C#COM对象中的代码:
using System;
using System.Web;
using System.Text;
using System.EnterpriseServices;
using System.Collections.Generic;
using System.Runtime.InteropServices;
[assembly: ApplicationName("BVSRegistration")]
[assembly: Description("COM+ upgrade of the BVSRegistration VB6 SignIn.cls.")]
[assembly: ApplicationActivation(ActivationOption.Server)]
[assembly: ApplicationAccessControl(false, AccessChecksLevel = AccessChecksLevelOption.ApplicationComponent)]
namespace BVSRegistration
{
public class SignIn : ServicedComponent
{
public void GetBankId(string bankid)
{
HttpContext.Current.Response.Redirect("http://www.google.com");
}
}
}
Any ideas? 有任何想法吗? Thanks
谢谢
ASP.Net's Response.Redirect
uses the ASP.Net stack, which is not in use in an ASP page. ASP.Net的
Response.Redirect
使用ASP.Net堆栈,而ASP页中未使用该堆栈。
You need to either switch away from ASP or call ASP's Response.Redirect
. 您需要退出ASP或调用ASP的
Response.Redirect
。
HttpContext will only be set in the context of an ASP.NET setting. HttpContext将仅在ASP.NET设置的上下文中设置。 Since you are calling from ASP classic, it won't be bound to the actual request/response stream.
由于您是从ASP Classic调用的,因此它不会绑定到实际的请求/响应流。
What you should do is indicate whether or not to redirect from your COM+ object, and call classic ASP's equivalent to Redirect. 您应该做的是指示是否要从COM +对象进行重定向,并调用等效于Redirect的经典ASP。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.