隐式和显式对象 [英] Implicit and explicit object

查看:113
本文介绍了隐式和显式对象的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在c#或asp.net中是否有任何隐式对象可用,如JSP请求,响应.

Is there any implict objects are available in c# or asp.net like JSP request,response.

推荐答案

是的,

在ASP.Net中,网页生成是在HttpApplication 对象的实例的上下文中进行的.
在页面或自定义控件中,这些内容是隐式可用的,因为它们作为这些项目所继承的基础对象中的属性包括在内.

在此类页面的上下文之外,您可以在此处找到当前的http执行上下文:

Yes,

In ASP.Net the web page generation works in context of an instance of the HttpApplication object.

In a page or a custom control these are available implicitly as they''re included as properties within the base objects these item inherit from.

Out of context of such pages you can find the current http execution context here:

System.Web.HttpContext.Current



该对象包括HttpSessionStateHttpRequestHttpResponse 的实例以及许多其他内容.

要访问它们并正确初始化它们,您必须在Web项目中工作并引用System.Web程序集.



This object includes instances of HttpSessionState, HttpRequest, HttpResponse and many other things.

To access these and have them properly initialised you must be working within a web project and have the System.Web assembly referenced.


这篇关于隐式和显式对象的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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