惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

H
Hackread – Cybersecurity News, Data Breaches, AI and More
C
Check Point Blog
Hacker News: Ask HN
Hacker News: Ask HN
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
WordPress大学
WordPress大学
P
Proofpoint News Feed
V
Visual Studio Blog
C
Cyber Attacks, Cyber Crime and Cyber Security
N
Netflix TechBlog - Medium
C
CXSECURITY Database RSS Feed - CXSecurity.com
博客园 - 聂微东
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
博客园 - 叶小钗
Cisco Talos Blog
Cisco Talos Blog
S
Schneier on Security
T
Threat Research - Cisco Blogs
腾讯CDC
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
The Hacker News
The Hacker News
Google DeepMind News
Google DeepMind News
Microsoft Security Blog
Microsoft Security Blog
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
GbyAI
GbyAI
N
News | PayPal Newsroom
L
LINUX DO - 最新话题
酷 壳 – CoolShell
酷 壳 – CoolShell
P
Palo Alto Networks Blog
T
Tenable Blog
S
Secure Thoughts
T
Threatpost
V2EX - 技术
V2EX - 技术
大猫的无限游戏
大猫的无限游戏
Martin Fowler
Martin Fowler
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
Vercel News
Vercel News
罗磊的独立博客
P
Privacy & Cybersecurity Law Blog
Engineering at Meta
Engineering at Meta
小众软件
小众软件
Google DeepMind News
Google DeepMind News
N
News and Events Feed by Topic
Y
Y Combinator Blog
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
C
Cybersecurity and Infrastructure Security Agency CISA
P
Proofpoint News Feed
L
Lohrmann on Cybersecurity
P
Privacy International News Feed
H
Heimdal Security Blog
量子位
B
Blog

博客园 - everx

CruiseControl.net - 找到的一些文档。分享出来 【摘抄】回归测试(Regression Test) 那就来说说ASP.NET MVC中的Routing吧 ASP.NET MVC - Controller(part Ⅱ) ASP.NET MVC - Controller(part Ⅰ) ASP.NET MVC - Model 学一下ASP.NET MVC C# 3.0的新特性 jQuery学习笔记(八) jQuery 学习笔记(七) SilverLight学习之路(四) Silverlight学习之路(三) - everx - 博客园 JQuery学习笔记(六) JQuery学习笔记(五) 初次使用log4net Silverlight学习之路(二) JQuery学习笔记(四) 播下silverlight的种子 JQuery学习笔记(三)
ASP.NET MVC - View
everx · 2009-10-22 · via 博客园 - everx

 首先,我要说的是,ASP.NET MVC的这个View并不是简单的Page而已,它实现了接口IView

public interface IView {
        
void Render(ViewContext viewContext, TextWriter writer);
    }

在ASP.NET MVC中,自带了一个默认的View那就是WebFormView

然后呢,在web请求到达controller,并且由controller返回ViewResult之后的操作,大概是这个样子的:

  1. ViewResult本身执行 ExecuteResult方法。这个方法是ActionResult接口的方法,ViewResult是实现这个接口的一个类。
  2. 找到相应的View
  3. 构造ViewContext
  4. Render
  5. 创建ViewPage
  6. 设置Layout位置

ViewPage(System.Web.Mvc.ViewPage)和之前的WebPage(System.Web.UI.Page)主要的区别是,的唯一的也是最重要的功能就是呈现页面。摒弃了WebPage的ViewState,PageEvents,Control层级关系。从代码看,ViewPage实现了IView接口,而这个接口仅有一个方法,那就是Render。可见其功能已经很确定了。

ViewEngine在MVC中是用来确定View的。也就是说,它负责找到特定的视图。默认的那个ViewEngine是WebFormViewEngine。如果呢,我们想要换一个视图,不想继续用aspx页面了,那么就需要重新构造一个ViewEngine,并注册到系统里。

Layout就相当于是MasterPage,不同的是,它没有了PostBack机制和表单提交机制。也就是说,它只能够为ViewPage布局。

ViewData之前已经说过一些了,View用它来呈现页面。不过,在这里要说的就是,一个View就只是对应一个ViewData,如果在一个View中有其他的PartialView,那么它们之间的ViewData是不共享的,虽然默认情况下内容是相同的。

View还有一些其他的知识,比如:BindAttribute,ModelState 等等。以后再研究了,感觉第一次遇到这么多东西,总是有一点混乱。

继续了……