1. aspx 与 ashx
我们知道 aspx :继承自 System.Web.UI.Page
然而Page:IHttpHandler
public class Page : TemplateControl, IHttpHandler
所以我们可以吧aspx看成是高级版的IHttpHandler,
在aspx 进行了高级的封装。
同样是生成HTML代码返回客户页面。
2. aspx 与 cs
aspx 是前端HMTL
cs 是aspx 的codebehind 后台代码。
首先
当我们 向服务器发送请求的时候 也就是输入 Index.aspx 页面的时候, 服务器 会创建一个 Index_aspx 的页面类对象
其中执行page_Load() 方法 调用的是 Page类中的(ProcessRequest)PR 方法 (可以有反编译器查看)
在服务器端是不存在Index.aspx页面的
我们看下面一行代码, 是新建页面后aspx第一行的代码。
<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPage/MasterPage.Master" AutoEventWireup="true" CodeBehind="Index.aspx.cs" Inherits="UI.View.Web.BasicUA.Index" %>
CodeBehid="Index.aspx.cs"
Inherits="UI.View.Web.BasicUA.Index"
这时候我们就可以看出 其实Index_aspx是继承自Index.aspx.cs
而 Index.cs是继承自Page
public partial class Index: System.Web.UI.Page