.net页面对象模型
外文资料原文
https://www.360docs.net/doc/5a11812946.html, PAGE OBJECT MODEL
Summary: Learn about the eventing model built around https://www.360docs.net/doc/5a11812946.html, Web pages and the various stages that a Web page experiences on its way to HTML. The https://www.360docs.net/doc/5a11812946.html, HTTP run time governs the pipeline of objects that transform the requested URL into a living instance of a page class first, and into plain HTML text next. Discover the events that characterize the lifecycle of a page and how control and page authors can intervene to alter the standard behavior. (6 printed pages) Introduction: Each request for a Microsoft? https://www.360docs.net/doc/5a11812946.html, page that hits Microsoft? Internet Information Services (IIS) is handed over to the https://www.360docs.net/doc/5a11812946.html, HTTP pipeline. The HTTP pipeline is a chain of managed objects that sequentially process the request and make the transition from a URL to plain HTML text happen. The entry point of the HTTP pipeline is the HttpRuntime class. The https://www.360docs.net/doc/5a11812946.html, infrastructure creates one instance of this class per each AppDomain hosted within the worker process (remember that the worker process maintains one distinct AppDomain per each https://www.360docs.net/doc/5a11812946.html, application currently running).
The HttpRuntime class picks up an HttpApplication object from an internal pool and sets it to work on the request. The main task accomplished by the HTTP application manager is finding out the class that will actually handle the request. When the request is for an .aspx resource, the handler is a page handler—namely, an instance of a class that inherits from Page. The association between types of resources and types of handlers is stored in the configuration file of the application. More exactly, the default set of mappings is defined in the
for .aspx resources.
An extension can be associated with a handler class, or more in general, with a handler factory class. In all cases, the HttpApplication object in charge for the request gets an object that implements the IHttpHandler interface. If the association resource/class is resolved in terms of a HTTP handler, then the returned class will implement the interface directly. If the resource is bound to a handler factory, an extra step is necessary. A handler factory class implements the IHttpHandlerFactory interface whose GetHandler method will return an IHttpHandler-based object.
How can the HTTP run time close the circle and process the page request? The IHttpHandler interface features the ProcessRequest method. By calling this method on the object that represents the requested page, the https://www.360docs.net/doc/5a11812946.html, infrastructure starts the process that will generate the output for the browser.
The Real Page Class
The type of the HTTP handler for a particular page depends on the URL. The first time the
URL is invoked, a new class is composed and dynamically compiled to an assembly. The source code of the class is the outcome of a parsing process that examines the .aspx sources. The class is defined as part of the namespace ASP and is given a name that mimics the original URL. For example, if the URL endpoint is page.aspx, the name of the class is ASP.Page_aspx. The class name, though, can be programmatically controlled by setting the ClassName attribute in the
@Page directive.
The base class for the HTTP handler is Page. This class defines the minimum set of methods and properties shared by all page handlers. The Page class implements the IHttpHandler interface.
Under a couple of circumstances, the base class for the actual handler is not Page but a different class. This happens, for example, if code-behind is used. Code-behind is a development technique that insulates the code necessary to a page into a separate C# or Microsoft Visual Basic? .NET class. The code of a page is the set of event handlers and helper methods that actually create the behavior of the page. This code can be defined inline using the B: 也可以直接给window.location属性赋值,window.location="url",与A不同的是有历史记录 C: 对于document,location不是不是对象,document.location=document.url
ASPNET对象
一、Response对象 Response对象是HttpResponse类的一个实例。该类主要是封装来自https://www.360docs.net/doc/5a11812946.html,操作的HTTP响应信息。 1.Response对象的属性 ①BufferOutput 说明:获取或设置一个值,该值指示是否缓冲输出,并在完成处理整个页之后将其发送 属性值:如果缓冲了到客户端的输出,则为true;否则为false。默认为true ②Cache 说明:获取Web页的缓存策略(过期时间、保密性、变化子句) 属性值:包含有关当前响应的缓存策略信息的HttpCachePolicy对象 ③Charset 说明:获取或设置输出流的HTTP字符集 属性值:输出流的HTTP字符集 ④IsClientConnected 说明:获取一个值,通过该值指示客户端是否仍连接在服务器上 属性值:如果客户端当前仍在连接,则为true;否则为false 2.Response对象的方法 Response对象可以输出信息到客户端,包括直接发送信息给浏览器、重定向浏览器到另一个URL或设置cookie的值。https://www.360docs.net/doc/5a11812946.html,中引用对象方法的语法是“对象名.方法名”。“方法”就是嵌入到对象定义中的程序代码,它定义对象怎样去处理信息。使用嵌入的方法,对象便知道如何去执行任务,而不用提供额外的指令。 ①Write 说明:将指定的字符串或表达式的结果写到当前的HTTP输出 ②End 说明:停止页面的执行并得到相应结果 ③Clear 说明:用来在不将缓存中的内容输出的前提下,清空当前页的缓存,仅当使用了缓存输出时,才可以利用Clear方法 ④Flush 说明:将缓存中的内容立即显示出来。该方法有一点和Clear方法一样,它在脚本前面没有将Buffer属性设置为True时会出错。和End方法不同的是,该方法调用后,该页面可继续执行 ⑤Redirect
WebDypro两个页面之间传值
WebDypro两个页面之间传值 WebDynpro for ABAP TM Scenario: To create and run a simple WebDynpro Application. We would accept an input value from the user on first screen and display the value entered on the second screen. Note:Please refer to the SAP? help for detailed information of the components used in this document. Procedure: 1.Go to transaction SE80. Please note that there is no separate transaction for creation of WebDynpro application other than SE80. 2.Select “WebDynpro Comp./Intf” from t he list (as shown below) 3.Create a new WebDynpro component by the name ZSAPTECHNICAL_DEMO.
Assign it to the local object. 4.Right click on the WebDynpro component “ZSAPTECHNICAL_DEMO” and create a view.
网络技术-数据库-HTTP开发-ASPNET内置对象小结-298
https://www.360docs.net/doc/5a11812946.html,内置对象小结: 1.Response对象 Response对象是HttpResponse类的一个实例。该类主要是封装来自https://www.360docs.net/doc/5a11812946.html,操作的HTTP响应信息。 服务器端利用Response对象的一些方法向客户端(浏览器)输出信息。 Response对象可以输出信息到客户端,包括直接发送信息给浏览器、重定向浏览器到另一个URL或设置cookie的值。 常用方法:Response.Write(),Response.Redirect()。 ① Write 说明:将指定的字符串或表达式的结果写到当前的HTTP输出 ⑤ Redirect 说明:使浏览器立即重定向到程序指定的URL 2.Request对象 Request对象用于获取从浏览器向服务器所发送的请求中的信息。当用户单击“提交”按钮时,包含在输入控件中的数据信息将会与表单一起被发送到服务器端。服务器端的Request对象就会读取通过HTTP请求发送的数据。
服务器端常常使用Request对象从客户端得到数据,它有两个常用方法,Form[]方法和QueryString[]方法。前者用来获取客户端以Post方式提交的数据,后者获取以Get方式提交的数据。 它还有一些有用的属性,可以获取客户端的一些信息,如客户端版本,客户端IP地址,当前网站的物理路径。 Request对象的属性 ① QueryString 说明:获取 HTTP 查询字符串变量集合 ② Browser 说明:获取有关正在请求的客户端的浏览器功能的信息 Request对象的方法 ①MapPath 说明:为当前请求将请求的URL中的虚拟路径映射到服务器上的物理路径。 3. Server对象 Server对象提供的方法和属性可以访问服务器,如MapPath()方法可以得到服务器上某文件的物理路径,HTMLEncode()可以对字符进行编码,输出平时无法输出的字符。
弹出页面和原页面之间传值
向使用 MultiView 和 GridView 控件的 JavaScript 弹出窗口要发送值和从之接收值 下载源代码 介绍 很多时候,我们要在我们的应用程序中创建一个弹出窗口。 通常当我们弹出一个窗口 ,我们还要使调用窗口和弹出的窗口进行交互。本文中我将展示如何在一个 https://www.360docs.net/doc/5a11812946.html, 应用程序中创建一个弹出窗口 (使用 JavaScript)和如何从弹出窗口返回值到原始的调用页面并自动引发该页上的按钮的单击事件。 另外,我将使用 MultiView 控件和 带分页的GridView 控件。 第一步:创建第一个页面 创建一个新的 https://www.360docs.net/doc/5a11812946.html, 网站,默认情况下您会自动创建 Default.aspx。在该页上添加一个标签、一文本框 (用于输入学生 ID)、一个链接按钮(单击它将弹出弹出窗口)和一个提交按钮。 您可以从工具箱中添加所有这些项。 为了提供更好的对齐方式,我把这些控件放到了 HTML table中。 下面是我在这里是我写了 div 标记内的完整代码。
| | |
|