Monthly Archives: October 2009

TheBeerHouse MVC 代码阅读(2)Site Layout

打开Master page Views/Shared/Site.Master,其中引用了/content/styles/site.css和/content/styles/modules.css其中site.css好像是从http://www.layouts4free.com/下载的整体布局为<div id=”header”></div><div id=”page”>      <div id=”content”></div>      <div id=”siderbar”>             <div id=”account”></div>             <div id=”admin”></div>             <div id=”current-poll”></div>      </div></div><div id=”footer”></div> 1. MVC编程对Master的使用 2. 在页面中嵌入控件<% Html.RenderPartial("~/Views/Shared/Poll/PollResultItem.ascx", poll); %>

Posted in Web Development | Leave a comment

TheBeerHouse MVC 代码阅读(3)Navigation System

1.程序的入口在web form编程模式下,每个请求都对应一个URL,每个URL都对应一个aspx文件,每个web site都会有一个default.aspx页面,它是web site的入口。如果用户只输入站点的URL,而不指定页面,IIS会认为用户要访问default.aspx因此对于II6S和VS中的itegrated web server,都是根据用户请求的文件的后缀(.aspx)进行处理,因此需要使用default.asxp把用户请求redirect到defalut route。MVC project template自动生成的default.aspx,在page_load中调用MvcHttpHandler.ProcessRequest处理用户请求,HttpContext.Current.RewritePath(Request.ApplicationPath, false);IHttpHandler httpHandler = new MvcHttpHandler();httpHandler.ProcessRequest(HttpContext.Current); 此时请求的url为"/",对应TheBeerHouse中提供的Route:routes.MapRoute("ArticleIndex",                        "",                        new { controller = "Article", action = "Index", category = (string)null, page = 1 }); 2. Routes register MVC要求在Application_Start()中调用 public static void RegisterRoutes(RouteCollection routes)进行注册 … Continue reading

Posted in Web Development | Leave a comment

TheBeerHouse MVC 代码阅读(1)

从功能上看,The Beer House 实现了一般网站常见的功能:News,Article,Blog,Poll,Newsletter,Forums,E-commerce store其实现过程一般为:design database Database Access layerimplement M-C-V 数据库设计成为了最核心的部分。 作者自己推荐的亮点有:http://thebeerhouse.codeplex.com/Release/ProjectReleases.aspx?ReleaseId=33900 使用了Entity Framework,Akimet,Gravatar,SEO(Search Engine Optimization) 实现了Photo Gallery,Calendar of Event, Login anywhere, Social Networking,Akimet 从设计上来看,最基本的元素为 网站布局(site layout) Navigation System Common Behavior Data Access Layer Business Logic Layer 用户管理(Membership and User … Continue reading

Posted in Web Development | Leave a comment

ASP.NET 程序的公用程序的dll必须放到GAC中

有两个Web Application,它们都会用到一个共公的Web Application,比如Launcher 和projectEditor都用到了Login 那么web程序Login所对应的dll就必须放到gac中。对于IIS和ASP.NET而言,看到的只有程序Launcher 和projectEditor,Login只是一个虚拟目录,

Posted in Web Development | Leave a comment