从.NET类访问内部ASP(不是ASP.NET)对象 [英] Accessing intrinsic ASP (not ASP.NET) objects from .NET class

查看:69
本文介绍了从.NET类访问内部ASP(不是ASP.NET)对象的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述




是否可以从.NET

类访问内部ASP对象,例如Request。说,我有一个通过COM或COM +包装器公开的.NET库。可以

这个库检索请求信息(基本上,服务器变量通过Request对象暴露

),当它从传统ASP调用时(不是

ASP.NET)应用程序?有任何想法吗?在此先感谢。


Alek

解决方案

Alek Davis写道:



是否可以从.NET
类访问内部ASP对象,例如Request。说,我有一个通过COM或COM +包装器公开的.NET库。当从传统的ASP(不是ASP.NET)应用程序调用它时,这个库可以检索请求信息(基本上是通过Request对象公开的服务器变量)吗?有任何想法吗?在此先感谢。

Alek




您可以尝试System.Web.HttpContext.Current.Request(.Current可能不会需要

等等,但我不知道是否转移了这个上下文并且可以在ASP.NET中正确读取
。从来没有在我自己之前完成这个,所以,只需要尝试一下......


-

Craig Deelsnyder
Microsoft MVP - ASP / ASP.NET


不,这不起作用。 Current.Request尝试检索ASP.NET应用程序的内部

对象,因此当从ASP应用程序调用它时,

将其值设置为NULL。据我所知ASP和ASP.NET使用不同的
内在对象。必须有办法做到这一点。感谢

的建议。


Alek


" Craig Deelsnyder" < cdeelsny@NO_SPAM_4_MEyahoo.com>在消息中写道

news:eP **************** @ TK2MSFTNGP11.phx.gbl ...

Alek Davis写道:



是否可以从
..NET类访问内部ASP对象,例如Request。说,我有一个通过COM或COM +包装器公开的.NET库。当从传统的ASP(不是ASP.NET)应用程序调用它时,这个库可以检索请求信息(基本上是通过Request对象公开的服务器变量
)吗?有任何想法吗?提前致谢。

Alek



您可以尝试System.Web.HttpContext.Current.Request(.Current可能不是
需要)等,但我不知道是否转移了上下文,并且可以在ASP.NET中正确读取。从来没有在我自己之前完成这个,所以,只需要尝试一下......

-
Craig Deelsnyder
Microsoft MVP - ASP / ASP.NET



没有。因为你的.net类是从asp调用的,而不是aspx,没有.net

请求对象或流。


backgroup,在aspx中,asp运行在一个单独的过程中,并使用命名管道

与iis进程进行通信。 .net响应对象写入此

管道。显然,如果你的.net对象是由asp托管的,那么这个管道就不存在
了。


你需要在你的asp类中添加一个方法可以注册基于

com的Request对象,因此.net代码可以与它通信。


- bruce(sqlwork.com)


" Alek Davis" < alek_xDOTx_davis_xATx_intel_xDOTx_com>在消息中写道

新闻:%2 **************** @ TK2MSFTNGP11.phx.gbl ...



是否可以从
..NET类访问内部ASP对象,例如Request。说,我有一个通过COM或COM +包装器公开的.NET库。当从传统的ASP(不是ASP.NET)应用程序调用它时,这个库可以检索请求信息(基本上是通过Request对象公开的服务器变量
)吗?有任何想法吗?提前致谢。

Alek



Hi,

Is it possible to access intrinsic ASP objects, such as Request, from a .NET
class. Say, I have a .NET library exposed via a COM or COM+ wrapper. Can
this library retrieve the request info (basically, server variables exposed
via the Request object), when it is invoked from a traditional ASP (not
ASP.NET) application? Any ideas? Thanks in advance.

Alek

解决方案

Alek Davis wrote:

Hi,

Is it possible to access intrinsic ASP objects, such as Request, from a .NET
class. Say, I have a .NET library exposed via a COM or COM+ wrapper. Can
this library retrieve the request info (basically, server variables exposed
via the Request object), when it is invoked from a traditional ASP (not
ASP.NET) application? Any ideas? Thanks in advance.

Alek



You can try System.Web.HttpContext.Current.Request (.Current may not be
needed), etc., but I don''t know if that context is transferred and can
be read correctly in the ASP.NET. Never done this before myself, tho,
just something to try...

--
Craig Deelsnyder
Microsoft MVP - ASP/ASP.NET


No, this does not work. Current.Request attempts to retrieve the intrinsic
object of ASP.NET application, so when it is called from an ASP application,
its values is set to NULL. As I understand ASP and ASP.NET use different
intrinsic objects. There must be a way of doing this. Thanks for the
suggestion, though.

Alek

"Craig Deelsnyder" <cdeelsny@NO_SPAM_4_MEyahoo.com> wrote in message
news:eP****************@TK2MSFTNGP11.phx.gbl...

Alek Davis wrote:

Hi,

Is it possible to access intrinsic ASP objects, such as Request, from a ..NET class. Say, I have a .NET library exposed via a COM or COM+ wrapper. Can
this library retrieve the request info (basically, server variables exposed via the Request object), when it is invoked from a traditional ASP (not
ASP.NET) application? Any ideas? Thanks in advance.

Alek



You can try System.Web.HttpContext.Current.Request (.Current may not be
needed), etc., but I don''t know if that context is transferred and can
be read correctly in the ASP.NET. Never done this before myself, tho,
just something to try...

--
Craig Deelsnyder
Microsoft MVP - ASP/ASP.NET



no. because your .net class is called from asp, not aspx, there is no .net
request object or stream.

backgroup, in aspx, asp runs in a seperate process, and uses a named pipes
to communicate to the iis process. the .net response object writes to this
pipe. obviously if you .net object is hosted by asp, this pipe does not
exist.

you will need to add a method to you class where the asp can register the
com based Request object, so the .net code can talk to it.

-- bruce (sqlwork.com)

"Alek Davis" <alek_xDOTx_davis_xATx_intel_xDOTx_com> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...

Hi,

Is it possible to access intrinsic ASP objects, such as Request, from a ..NET class. Say, I have a .NET library exposed via a COM or COM+ wrapper. Can
this library retrieve the request info (basically, server variables exposed via the Request object), when it is invoked from a traditional ASP (not
ASP.NET) application? Any ideas? Thanks in advance.

Alek



这篇关于从.NET类访问内部ASP(不是ASP.NET)对象的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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