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

推荐订阅源

OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
Security Archives - TechRepublic
Security Archives - TechRepublic
N
News and Events Feed by Topic
Last Week in AI
Last Week in AI
博客园 - 司徒正美
The GitHub Blog
The GitHub Blog
O
OpenAI News
The Last Watchdog
The Last Watchdog
T
The Blog of Author Tim Ferriss
M
MIT News - Artificial intelligence
P
Proofpoint News Feed
Forbes - Security
Forbes - Security
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
有赞技术团队
有赞技术团队
Jina AI
Jina AI
GbyAI
GbyAI
V
Vulnerabilities – Threatpost
L
LangChain Blog
Vercel News
Vercel News
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
AI
AI
博客园 - 聂微东
W
WeLiveSecurity
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
Scott Helme
Scott Helme
罗磊的独立博客
Martin Fowler
Martin Fowler
S
Security Affairs
T
Tor Project blog
Recent Announcements
Recent Announcements
F
Fortinet All Blogs
美团技术团队
C
Cisco Blogs
PCI Perspectives
PCI Perspectives
Recent Commits to openclaw:main
Recent Commits to openclaw:main
S
Security @ Cisco Blogs
T
Threat Research - Cisco Blogs
A
About on SuperTechFans
Cisco Talos Blog
Cisco Talos Blog
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
I
Intezer
B
Blog
WordPress大学
WordPress大学
I
InfoQ
G
Google Developers Blog
www.infosecurity-magazine.com
www.infosecurity-magazine.com
V
V2EX
P
Privacy & Cybersecurity Law 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 等等。以后再研究了,感觉第一次遇到这么多东西,总是有一点混乱。

继续了……