📜  ASP.NET-简介

📅  最后修改于: 2020-11-21 05:37:56             🧑  作者: Mango


ASP.NET是一个Web开发平台,可提供编程模型,全面的软件基础结构以及为PC和移动设备构建健壮的Web应用程序所需的各种服务。

ASP.NET在HTTP协议的基础上工作,并使用HTTP命令和策略来设置浏览器到服务器的双向通信和合作。

ASP.NET是Microsoft .Net平台的一部分。 ASP.NET应用程序是编译后的代码,使用.Net框架中存在的可扩展和可重用的组件或对象编写。这些代码可以使用.Net框架中类的整个层次结构。

可以使用以下任何一种语言编写ASP.NET应用程序代码:

  • C#
  • Visual Basic.Net
  • 脚本
  • J#

ASP.NET用于通过Internet生成交互式的,数据驱动的Web应用程序。它由大量控件组成,例如文本框,按钮和标签,用于组合,配置和操作代码以创建HTML页面。

ASP.NET Web窗体模型

ASP.NET Web表单将事件驱动的交互模型扩展到Web应用程序。浏览器将Web表单提交到Web服务器,服务器作为响应返回完整的标记页面或HTML页面。

所有客户端用户活动都转发到服务器以进行状态处理。服务器处理客户端操作的输出并触发响应。

现在,HTTP是无状态协议。 ASP.NET框架有助于存储有关应用程序状态的信息,该信息包括:

  • 页面状态
  • 会话状态

页面状态是客户端的状态,即Web表单中各种输入字段的内容。会话状态是从用户访问并使用过的各个页面获得的集体信息,即整个会话状态。为了阐明这个概念,让我们以购物车为例。

用户将项目添加到购物车。从页面上选择项目,例如,项目页面,收集的总项目和价格显示在不同的页面上,例如购物车页面。只有HTTP无法跟踪来自各个页面的所有信息。 ASP.NET会话状态和服务器端基础结构跟踪整个会话中全局收集的信息。

ASP.NET运行时在生成ASP.NET运行时代码时跨页面请求携带往返服务器的页面状态,并在隐藏字段中合并服务器端组件的状态。

这样,服务器即可了解整个应用程序状态,并以两层连接的方式运行。

ASP.NET组件模型

ASP.NET组件模型提供了ASP.NET页的各种构建块。基本上,它是一个对象模型,它描述:

  • 几乎所有HTML元素或标记(例如

    )的服务器端副本。

  • 服务器控件,有助于开发复杂的用户界面。例如,“日历”控件或“网格视图”控件。

ASP.NET是一项在包含所有与Web相关的功能的.Net框架上工作的技术。 .Net框架由面向对象的层次结构组成。 ASP.NET Web应用程序由页面组成。当用户请求ASP.NET页面时,IIS将页面的处理委托给ASP.NET运行时系统。

ASP.NET运行时将.aspx页转换为类的实例,该类继承自.Net框架的基类页。因此,每个ASP.NET页都是一个对象,并且其所有组件(即服务器端控件)也是对象。

.Net Framework 3.5的组件

在进入下一个关于Visual Studio.Net的会话之前,让我们看一下.Net Framework 3.5的各个组件。下表描述了.Net Framework 3.5的组件及其执行的工作:

Components and their Description

(1) Common Language Runtime or CLR

It performs memory management, exception handling, debugging, security checking, thread execution, code execution, code safety, verification, and compilation. The code that is directly managed by the CLR is called the managed code. When the managed code is compiled, the compiler converts the source code into a CPU independent intermediate language (IL) code. A Just In Time(JIT) compiler compiles the IL code into native code, which is CPU specific.

(2) .Net Framework Class Library

It contains a huge library of reusable types. classes, interfaces, structures, and enumerated values, which are collectively called types.

(3) Common Language Specification

It contains the specifications for the .Net supported languages and implementation of language integration.

(4) Common Type System

It provides guidelines for declaring, using, and managing types at runtime, and cross-language communication.

(5) Metadata and Assemblies

Metadata is the binary information describing the program, which is either stored in a portable executable file (PE) or in the memory. Assembly is a logical unit consisting of the assembly manifest, type metadata, IL code, and a set of resources like image files.

(6) Windows Forms

Windows Forms contain the graphical representation of any window displayed in the application.

(7) ASP.NET and ASP.NET AJAX

ASP.NET is the web development model and AJAX is an extension of ASP.NET for developing and implementing AJAX functionality. ASP.NET AJAX contains the components that allow the developer to update data on a website without a complete reload of the page.

(8) ADO.NET

It is the technology used for working with data and databases. It provides access to data sources like SQL server, OLE DB, XML etc. The ADO.NET allows connection to data sources for retrieving, manipulating, and updating data.

(9) Windows Workflow Foundation (WF)

It helps in building workflow-based applications in Windows. It contains activities, workflow runtime, workflow designer, and a rules engine.

(10) Windows Presentation Foundation

It provides a separation between the user interface and the business logic. It helps in developing visually stunning interfaces using documents, media, two and three dimensional graphics, animations, and more.

(11) Windows Communication Foundation (WCF)

It is the technology used for building and executing connected systems.

(12) Windows CardSpace

It provides safety for accessing resources and sharing personal information on the internet.

(13) LINQ

It imparts data querying capabilities to .Net languages using a syntax which is similar to the tradition query language SQL.