简体   繁体   English

从经典ASP页调用的COM +对象中的Response.Redirect

[英]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.

相关问题 无法在页面回调中调用 Response.Redirect - Response.Redirect cannot be called in a Page callback 经典ASP中找不到注册的COM +对象 - Registered COM+ object cannot be found in classic asp 母版页在 Response.Redirect asp.net c# 中被调用两次 - Master Page is getting called twice in Response.Redirect asp.net c# 如何避免“无法在页面回调中调用Response.Redirect” - How to avoid “Response.Redirect cannot be called in a Page callback” ASP.NET Response.Redirect,删除metasapiens页面方法 - ASP.NET Response.Redirect, remove metasapiens page methods 将带有 COM+ 的经典 ASP 迁移到 Azure Cloud 和 DLL - Migrate classic ASP with COM+ to Azure Cloud and DLLs Response.Redirect从Web解决方案文件夹内的页面重定向? - Response.Redirect from a page inside a folder of web solution? Response.Redirect() 重定向到子文件夹中的页面 - Response.Redirect() to redirect to a page in a subfolder 如果response.redirect失败,则重定向到页面 - redirect to a page if response.redirect fails 从ASP.net将会话存储在Redis服务器中,同时使用Response.redirect重定向到其他页面时会抛出错误 - storing session in redis server from ASP.net while redirecting to some other page using Response.redirect it is throwing error
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM