仓酷云

 找回密码
 立即注册
搜索
热搜: 活动 交友 discuz
查看: 878|回复: 9
打印 上一主题 下一主题

[学习教程] ASP.NET教程之Community Server专题六:Delegates & ...

[复制链接]
海妖 该用户已被删除
跳转到指定楼层
楼主
发表于 2015-1-16 22:35:44 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有帐号?立即注册

x
我感觉可以顶到50楼,出乎意料的是大家居然纷纷写出自己的博文,还被编辑做成了专题,置于首页头条。server关于CS的剖析你能够能会从页面入手下手,实在那并非一个很好的办法,由于CS接纳了MasterPage和内建的Theme与Skins,页面一层嵌套一层,假如你对CS页面实行机制不懂得,大概你是初学者,这个时分大概就会受阻,接着就保持了对CS更深切的懂得。我但愿我的专题能从CS的运转历程入手下手一步一步地解说,同时把ASP.NET的运转机理也表述出来,因而进修懂得CS的历程就是对ASP.NET深切懂得得历程。固然,我团体的开辟履历与程度也是无限的,假如在专题中表述有成绩,大概有疑问能够间接在文章的批评中间接指出,我将万分感激你。
在剖析CSHttpModule.cs的时分,你会看到如许两句代码:
CSEvents.UserKnown(csContext.User);
CSEvents.CSException(csException);
实在短短两行代码前面埋没了Delegates与Events的大批使用,CS也经由过程如许的使用完成了一种模块化的处置机制,即CSModules。
翻开CommunityServerWeb项面前目今的communityserver.config文件,这是CS的设置文件(与Web.config分歧,communityserver.config次要设置的是CS外部的一些运转机制,而Web.config次要设置的是与Asp.net的交互)。找到文件中的这段:
<CSModules>
<addname="CSMembershipRulesModule"type="CommunityServer.Components.CSMembershipRulesModule,CommunityServer.Components"/>
<addname="CSCatastrophicExceptionModule"type="CommunityServer.Components.CSCatastrophicExceptionModule,CommunityServer.Components"/>
<addname="CSExceptionModule"type="CommunityServer.Components.CSExceptionModule,CommunityServer.Components"/>
<addname="IrcCommands"type="CommunityServer.Discussions.Components.IrcCommandsModule,CommunityServer.Discussions"/>
<addname="ForumCensorship"type="CommunityServer.Discussions.Components.CensorshipModule,CommunityServer.Discussions"/>
<addname="ForumEmoticon"type="CommunityServer.Discussions.Components.EmoticonModule,CommunityServer.Discussions"/>
<addname="ForumSourceCode"type="CommunityServer.Discussions.Components.SourceCodeModule,CommunityServer.Discussions"/>
<addname="ForumHtmlScrubbing"type="CommunityServer.Discussions.Components.HtmlScrubbingModule,CommunityServer.Discussions"/>
<addname="BBcodeToHtml"type="CommunityServer.Discussions.Components.BBcodeToHtmlModule,CommunityServer.Discussions"/>
<addname="ForumPlainText"type="CommunityServer.Discussions.Components.PlainTextModule,CommunityServer.Discussions"/>
<addname="WeblogCensorModule"type="CommunityServer.Blogs.Components.CensorModule,CommunityServer.Blogs"/>
<addname="WeblogPostandArticleHtmlScrubbing"type="CommunityServer.Blogs.Components.PostandArticleHtmlScrubbing,CommunityServer.Blogs"/>
<addname="WeblogFeedbackHtmlFormatting"type="CommunityServer.Blogs.Components.FeedbackHtmlFormatting,CommunityServer.Blogs"/>
<addname="TrackbackModule"type="CommunityServer.Blogs.Components.TrackbackModule,CommunityServer.Blogs"/>
<addname="XmlRpcPingModule"type="CommunityServer.Blogs.Components.XmlRpcPingModule,CommunityServer.Blogs"/>
<addname="WeblogFormattingModule"type="CommunityServer.Blogs.Components.WeblogFormattingModule,CommunityServer.Blogs"/>
<addname="PictureCensor"type="CommunityServer.Galleries.Components.CensorPictureModule,CommunityServer.Galleries"/>
<addname="PictureHtmlScrubber"type="CommunityServer.Galleries.Components.HtmlScrubberModule,CommunityServer.Galleries"/>
<addname="PictureComments"type="CommunityServer.Galleries.Components.CommentModule,CommunityServer.Galleries"/>
<!--<addname="MaxPictureSize"type="CommunityServer.Galleries.Components.MaxPictureSizeModule,CommunityServer.Galleries"maxWidth="1024"maxHeight="768"quality="90"/>-->
</CSModules>
我们拿出个中的一个来剖析运转历程,例:
<addname="CSExceptionModule"type="CommunityServer.Components.CSExceptionModule,CommunityServer.Components"/>
这是CS中非常处置的模块,当产生非常的时分该模块将挪用一个RedirectToMessage办法,提醒一个友爱的毛病界面,告知哀求的用户有毛病产生。那末CS体系是怎样在产生毛病的时分主动挪用RedirectToMessage办法转向别的一个页面提醒友爱毛病的呢?先翻开CommunityServerComponents项面前目今Components文件夹中的CSApplication.cs
usingSystem;
usingSystem.Collections;
usingSystem.ComponentModel;
usingSystem.Web.Caching;
usingSystem.Xml;
usingCommunityServer.Configuration;
namespaceCommunityServer.Components
{
Delegates#regionDelegates
//Dowewantonesingledelegateoracustomoneforeachtype
//publicdelegatevoidCSEventHandler(objectsender,CSEventArgse);
publicdelegatevoidCSUserEventHandler(Useruser,CSEventArgse);
publicdelegatevoidCSPostEventHandler(Postpost,CSEventArgse);
publicdelegatevoidCSSectionEventHandler(Sectionsection,CSEventArgse);
publicdelegatevoidCSGroupEventHandler(Groupgroup,CSEventArgse);
publicdelegatevoidCSExceptionHandler(CSExceptioncsEx,CSEventArgse);
#endregion
/**////<summary>
///SummarydescriptionforCSApplication.
///</summary>
publicclassCSApplication
{
privatemembers#regionprivatemembers
privateEventHandlerListEvents=newEventHandlerList();
privatestaticreadonlyobjectsync=newobject();
privateHashtablemodules=newHashtable();
#endregion
EventKeys(static)#regionEventKeys(static)
privatestaticobjectEventAuthorizePost=newobject();
privatestaticobjectEventPrePostUpdate=newobject();
privatestaticobjectEventPreProcessPost=newobject();
privatestaticobjectEventPostPostUpdate=newobject();
privatestaticobjectEventRatePost=newobject();
//privatestaticobjectEventPreRenderPost=newobject();
privatestaticobjectEventPreUserUpdate=newobject();
privatestaticobjectEventPostUserUpdate=newobject();
privatestaticobjectEventUserRemove=newobject();
privatestaticobjectEventUserKnown=newobject();
privatestaticobjectEventUserValidated=newobject();
privatestaticobjectEventPreSectionUpdate=newobject();
privatestaticobjectEventPostSectionUpdate=newobject();
privatestaticobjectEventPreSectionGroupUpdate=newobject();
privatestaticobjectEventPostSectionGroupUpdate=newobject();
privatestaticobjectEventUnhandledException=newobject();
#endregion
cnstr#regioncnstr
privateCSApplication()
{
}
internalstaticCSApplicationInstance()
{
conststringkey="CSApplication";
CSApplicationapp=CSCache.Get(key)asCSApplication;
if(app==null)
{
lock(sync)
{
app=CSCache.Get(key)asCSApplication;
if(app==null)
{
CSConfigurationconfig=CSContext.Current.Config;
XmlNodenode=config.GetConfigSection("CommunityServer/CSModules");
app=newCSApplication();
if(node!=null)
{
foreach(XmlNodeninnode.ChildNodes)
{
if(n.NodeType!=XmlNodeType.Comment)
{
switch(n.Name)
{
case"clear":
app.modules.Clear();
break;
case"remove":
app.modules.Remove(n.Attributes["name"].Value);
break;
case"add":
stringname=n.Attributes["name"].Value;
stringitype=n.Attributes["type"].Value;
Typetype=Type.GetType(itype);
if(type==null)
thrownewException(itype+"doesnotexist");
ICSModulemod=Activator.CreateInstance(type)asICSModule;
if(mod==null)
thrownewException(itype+"doesnotimplementICSModuleorisnotconfiguredcorrectly");
mod.Init(app,n);
app.modules.Add(name,mod);
break;
}
}
}
}
CacheDependencydep=newCacheDependency(null,newstring[]{CSConfiguration.CacheKey});
CSCache.Max(key,app,dep);
}
}
}
returnapp;
}
#endregion
PostEvents#regionPostEvents
ExecuteEvents#regionExecuteEvents
internalvoidExecuteAuthorizePost()
{
ExecuteUserEvent(EventAuthorizePost,CSContext.Current.User);
}
internalvoidExecutePrePostEvents(Postpost,ObjectStatestate,ApplicationTypeappType)
{
ExecutePostEvent(EventPreProcessPost,post,state,appType);
}
internalvoidExecutePrePostUpdateEvents(Postpost,ObjectStatestate,ApplicationTypeappType)
{
ExecutePostEvent(EventPrePostUpdate,post,state,appType);
}
internalvoidExecutePostPostUpdateEvents(Postpost,ObjectStatestate,ApplicationTypeappType)
{
ExecutePostEvent(EventPostPostUpdate,post,state,appType);
}
internalvoidExecuteRatePostEvents(Postpost,ApplicationTypeappType)
{
ExecutePostEvent(EventRatePost,post,ObjectState.None,appType);
}
//internalvoidExecutePrePostRender(Postpost,ApplicationTypeappType)
//{
//ExecutePostEvent(EventPreRenderPost,post,ObjectState.None,appType);
//}
protectedvoidExecutePostEvent(objectEventKey,Postpost,ObjectStatestate,ApplicationTypeappType)
{
CSPostEventHandlerhandler=Events[EventKey]asCSPostEventHandler;
if(handler!=null)
{
handler(post,newCSEventArgs(state,appType));
}
}
#endregion
Events#regionEvents
/**////<summary>
///Eventraisedbeforeauseraccessesapagewhichcanbeusedtocreatecontent
///</summary>
publiceventCSUserEventHandlerAuthorizePost
{
add{Events.AddHandler(EventAuthorizePost,value);}
remove{Events.RemoveHandler(EventAuthorizePost,value);}
}
/**////<summary>
///Eventraisedbeforeanypostprocessingtakesplace
///</summary>
publiceventCSPostEventHandlerPreProcessPost
{
add{Events.AddHandler(EventPreProcessPost,value);}
remove{Events.RemoveHandler(EventPreProcessPost,value);}
}
/**////<summary>
///FiresafterPreProcessPostbutbeforethepostchangeiscommitedtothedatastore
///</summary>
publiceventCSPostEventHandlerPrePostUpdate
{
add{Events.AddHandler(EventPrePostUpdate,value);}
remove{Events.RemoveHandler(EventPrePostUpdate,value);}
}
/**////<summary>
///Firesafterapostchangeiscommitedtothedatastore
///</summary>
publiceventCSPostEventHandlerPostPostUpdate
{
add{Events.AddHandler(EventPostPostUpdate,value);}
remove{Events.RemoveHandler(EventPostPostUpdate,value);}
}
/**////<summary>
///FiresafteraPostorThreadisrated
///</summary>
publiceventCSPostEventHandlerRatePost
{
add{Events.AddHandler(EventRatePost,value);}
remove{Events.RemoveHandler(EventRatePost,value);}
}
/////<summary>
/////Eventraisedbeforeanindividualpostisrendered
/////</summary>
//publiceventCSPostEventHandlerPreRenderPost
//{
//add{Events.AddHandler(EventPreRenderPost,value);}
//remove{Events.RemoveHandler(EventPreRenderPost,value);}
//}
#endregion
#endregion
UserEvents#regionUserEvents
ExecuteEvents#regionExecuteEvents
internalvoidExecuteUserValidated(Useruser)
{
ExecuteUserEvent(EventUserValidated,user);
}
internalvoidExecuteUserKnown(Useruser)
{
ExecuteUserEvent(EventUserKnown,user);
}
internalvoidExecutePreUserUpdate(Useruser,ObjectStatestate)
{
ExecuteUserEvent(EventPreUserUpdate,user,state,ApplicationType.Unknown);
}
internalvoidExecutePostUserUpdate(Useruser,ObjectStatestate)
{
ExecuteUserEvent(EventPostUserUpdate,user,state,ApplicationType.Unknown);
}
internalvoidExecuteUserRemove(Useruser)
{
ExecuteUserEvent(EventUserRemove,user,ObjectState.Delete,ApplicationType.Unknown);
}
protectedvoidExecuteUserEvent(objectEventKey,Useruser)
{
ExecuteUserEvent(EventKey,user,ObjectState.None,ApplicationType.Unknown);
}
protectedvoidExecuteUserEvent(objectEventKey,Useruser,ObjectStatestate,ApplicationTypeappType)
{
CSUserEventHandlerhandler=Events[EventKey]asCSUserEventHandler;
if(handler!=null)
{
handler(user,newCSEventArgs(state,appType));
}
}
#endregion
Events#regionEvents
/**////<summary>
///Firesafterauserscredentialshavebeenvalidated.
///</summary>
publiceventCSUserEventHandlerUserValidated
{
add{Events.AddHandler(EventUserValidated,value);}
remove{Events.RemoveHandler(EventUserValidated,value);}
}
/**////<summary>
///Firesoncethecurrentuserhasbeenidentified.Thisusermaystillbeanonymous.
///</summary>
publiceventCSUserEventHandlerUserKnown
{
add{Events.AddHandler(EventUserKnown,value);}
remove{Events.RemoveHandler(EventUserKnown,value);}
}
/**////<summary>
///FiresbeforeaUserissaved/updatedtothedatastore
///</summary>
publiceventCSUserEventHandlerPreUserUpdate
{
add{Events.AddHandler(EventPreUserUpdate,value);}
remove{Events.RemoveHandler(EventPreUserUpdate,value);}
}
/**////<summary>
///FiresafteraUserissaved/updatedtothedatastore
///</summary>
publiceventCSUserEventHandlerPostUserUpdate
{
add{Events.AddHandler(EventPostUserUpdate,value);}
remove{Events.RemoveHandler(EventPostUserUpdate,value);}
}
/**////<summary>
///FiresbeforeaUserisremovedfromthedatastore.
///</summary>
publiceventCSUserEventHandlerUserRemove
{
add{Events.AddHandler(EventUserRemove,value);}
remove{Events.RemoveHandler(EventUserRemove,value);}
}
#endregion
#endregion
SectionEvents#regionSectionEvents
internalvoidExecutePreSectionUpdate(Sectionsection,ObjectStatestate,ApplicationTypeappType)
{
CSSectionEventHandlerhandler=Events[EventPreSectionUpdate]asCSSectionEventHandler;
if(handler!=null)
{
handler(section,newCSEventArgs(state,appType));
}
}
internalvoidExecutePostSectionUpdate(Sectionsection,ObjectStatestate,ApplicationTypeappType)
{
CSSectionEventHandlerhandler=Events[EventPostSectionUpdate]asCSSectionEventHandler;
if(handler!=null)
{
handler(section,newCSEventArgs(state,appType));
}
}
/**////<summary>
///Eventraisedbeforeasectionchangeiscommittedtothedatastore(create/update)
///</summary>
publiceventCSSectionEventHandlerPreSectionUpdate
{
add{Events.AddHandler(EventPreSectionUpdate,value);}
remove{Events.RemoveHandler(EventPreSectionUpdate,value);}
}
/**////<summary>
///Eventraisedafterasectionchageiscommittedtothedatastore
///</summary>
publiceventCSSectionEventHandlerPostSectionUpdate
{
add{Events.AddHandler(EventPostSectionUpdate,value);}
remove{Events.RemoveHandler(EventPostSectionUpdate,value);}
}
#endregion
GroupEvents#regionGroupEvents
internalvoidExecutePreSectionGroupUpdate(Groupgroup,ObjectStatestate,ApplicationTypeappType)
{
CSGroupEventHandlerhandler=Events[EventPreSectionGroupUpdate]asCSGroupEventHandler;
if(handler!=null)
{
handler(group,newCSEventArgs(state,appType));
}
}
internalvoidExecutePostSectionGroupUpdate(Groupgroup,ObjectStatestate,ApplicationTypeappType)
{
CSGroupEventHandlerhandler=Events[EventPostSectionGroupUpdate]asCSGroupEventHandler;
if(handler!=null)
{
handler(group,newCSEventArgs(state,appType));
}
}
/**////<summary>
///Eventraisedbeforeagroupchageiscommittedtothedatastore(create/update)
///</summary>
publiceventCSGroupEventHandlerPreSectionGroupUpdate
{
add{Events.AddHandler(EventPreSectionGroupUpdate,value);}
remove{Events.RemoveHandler(EventPreSectionGroupUpdate,value);}
}
/**////<summary>
///Eventraisedafteragroupchageiscommittedtothedatastore
///</summary>
publiceventCSGroupEventHandlerPostSectionGroupUpdate
{
add{Events.AddHandler(EventPostSectionGroupUpdate,value);}
remove{Events.RemoveHandler(EventPostSectionGroupUpdate,value);}
}
#endregion
Exceptions#regionExceptions
/**////<summary>
///Eventraisedbeforeagroupchageiscommittedtothedatastore(create/update)
///</summary>
publiceventCSExceptionHandlerCSException
{
add{Events.AddHandler(EventUnhandledException,value);}
remove{Events.RemoveHandler(EventUnhandledException,value);}
}
internalvoidExecuteCSExcetion(CSExceptioncsEx)
{
CSExceptionHandlerhandler=Events[EventUnhandledException]asCSExceptionHandler;
if(handler!=null)
{
handler(csEx,newCSEventArgs());
}
}
#endregion
}
}
文件太长,我们抓出关头的部分来剖析:
publicdelegatevoidCSExceptionHandler(CSExceptioncsEx,CSEventArgse);
这里先声名一个托付,相称于一个函数指针。在普通一点了解它就是一个跑腿的,专管传送工具与工具间的挪用信息。
接上去:
internalstaticCSApplicationInstance()
{
conststringkey="CSApplication";
CSApplicationapp=CSCache.Get(key)asCSApplication;
if(app==null)
{
lock(sync)
{
app=CSCache.Get(key)asCSApplication;
if(app==null)
{
CSConfigurationconfig=CSContext.Current.Config;
XmlNodenode=config.GetConfigSection("CommunityServer/CSModules");
app=newCSApplication();
if(node!=null)
{
foreach(XmlNodeninnode.ChildNodes)
{
if(n.NodeType!=XmlNodeType.Comment)
{
switch(n.Name)
{
case"clear":
app.modules.Clear();
break;
case"remove":
app.modules.Remove(n.Attributes["name"].Value);
break;
case"add":
stringname=n.Attributes["name"].Value;
stringitype=n.Attributes["type"].Value;
Typetype=Type.GetType(itype);
if(type==null)
thrownewException(itype+"doesnotexist");
ICSModulemod=Activator.CreateInstance(type)asICSModule;
if(mod==null)
thrownewException(itype+"doesnotimplementICSModuleorisnotconfiguredcorrectly");
mod.Init(app,n);
app.modules.Add(name,mod);
break;
}
}
}
}
CacheDependencydep=newCacheDependency(null,newstring[]{CSConfiguration.CacheKey});
CSCache.Max(key,app,dep);
}
}
}
returnapp;
}
这段很主要,经由过程读取communityserver.config文件的<CSModules>,初始化每一个CSModule,注重,初始化后而且挪用了这些CSModule中的Init办法。详细看看这些Module中的Init都做了甚么,翻开CommunityServerComponents项面前目今的Components文件夹中的CSExceptionModule.cs:
usingSystem;
usingSystem.Web;
namespaceCommunityServer.Components
{
/**////<summary>
///SummarydescriptionforCSExceptionModule.
///</summary>
publicclassCSExceptionModule:ICSModule
{
publicCSExceptionModule()
{
//
//TODO:Addconstructorlogichere
//
}
ICSModuleMembers#regionICSModuleMembers
publicvoidInit(CSApplicationcsa,System.Xml.XmlNodenode)
{
csa.CSException+=newCSExceptionHandler(csa_CSException);
}
#endregion
privatevoidcsa_CSException(CSExceptioncsEx,CSEventArgse)
{
CSContextcsContext=CSContext.Current;
if(csEx.ExceptionType!=CSExceptionType.UnknownError&&csContext.IsWebRequest)
{
RedirectToMessage(csContext.Context,csEx);
}
}
privatestaticvoidRedirectToMessage(HttpContextcontext,CSExceptionexception)
{
if((exception.InnerException!=null)&&(exception.InnerExceptionisCSException))
{
CSExceptioninner=(CSException)exception.InnerException;
}
context.Response.Redirect(Globals.GetSiteUrls().Message(exception.ExceptionType),true);
}
}
}
哈哈,本来在Init办法里把一个CSExceptionHandler托付增加到CSException事务上,这个托付指向csa_CSException办法,仍是普通点说:假如CSException这个事务产生了,CSExceptionHandler这个跑腿的托付就会即刻告知csa_CSException办法要他实行,假如事务没有被引发就甚么也不做。
名词:event关头字使您得以指定今世码中的某些“事务”产生时挪用的托付。此托付能够有一个或多个联系关系的办法,今世码唆使该事务已产生时将挪用联系关系的办法。
那末这个CSException又是怎样回事?在那里界说的?我们回到CSApplication.cs文件中,看样几行:
publiceventCSExceptionHandlerCSException
{
add{Events.AddHandler(EventUnhandledException,value);}
remove{Events.RemoveHandler(EventUnhandledException,value);}
}
这里界说了一个CSException事务,而事务产生的时分只能用CSExceptionHandler这个托付来做跑腿的。实在CS中是把托付都寄存在了一个EventHandlerList中,因而此处你能够看到add与remove,这是会见器的声明,用于增加或移除客户代码中的事务处置程序,如许做的优点是公然大批的事务但不为每一个事务分派字段,而是利用EventHandlerList存储这些事务实例。为了了解事务的挪用实行历程,我们还必需看几个文件:CSEvents.cs、CSEventArgs.cs:
CSEventArgs.cs存储事务的数据,这个很好了解,它承继自EventArgs。当事务产生时CSEventArgs用来传送事务的信息,这里传送两个值:ObjectState与ApplicationType(能够在Enumerations文件夹下找到这两个列举的内容)
CSEvents.cs这是对事务挪用的一个包装器,看非常处置的包装:
publicstaticvoidCSException(CSExceptioncsEx)
{
CSApplication.Instance().ExecuteCSExcetion(csEx);
}
这里先挪用CSApplication.Instance()办法,实例化一个CSApplication工具,假如你是第一次挪用Instance()办法,就实例化一切在<CSModules>中设置的类,而且挪用他们的Init办法(在CSModules中设置的这些类,都完成了ICSModule接口,而这个接口请求承继他的类都具有Init办法),实行Init办法的目标就是把托付增加到事务上,使托付指向的办法能够在事务触发的时分被挪用。实例化后再挪用ExecuteCSExcetion办法而且传送CSException的实例,ExecuteCSExcetion办法以下:
internalvoidExecuteCSExcetion(CSExceptioncsEx)
{
CSExceptionHandlerhandler=Events[EventUnhandledException]asCSExceptionHandler;
if(handler!=null)
{
handler(csEx,newCSEventArgs());
}
}
先经由过程对EventHandlerList索引会见,即Events[EventUnhandledException],从列表中找到这个CSExceptionHandler事务,假如不为null就实行它。EventUnhandledException又是甚么,实在这只是一个Key,用来标示存储的事务。
有需要总结一下,否则你会被这类挪用来挪用往的干系弄得一头雾水,
以非常处置为例:
1:在毛病产生后,挪用Application_OnError办法;
2:在办法的最初挪用CSEvents.CSException(csException);
3:进进CSEvents包装器,挪用CSApplication.Instance().ExecuteCSExcetion(csEx);
<P>4:实行CSAppJ2EE比较成熟一点,一些比较出名的企业应用软件都是基于J2EE的。以后的发展就不好说了。不过java比较烦,学.net的话,微软把很多工具都封装好了,学起来可能容易一点。
乐观 该用户已被删除
沙发
发表于 2015-1-17 17:42:35 | 只看该作者
大哥拜托,Java在95年就出来了,微软垄断个妹啊,服务器市场微软完全是后后来者,当年都是Unix的市场,现在被WindowsServer和Linux抢下大片,包括数据库也一样。
谁可相欹 该用户已被删除
板凳
发表于 2015-1-20 23:45:55 | 只看该作者
以上是语言本身的弱点,在功能方面ASP同样存在问题,第一是功能太弱,一些底层操作只能通过组件来完成,在这点上是远远比不上PHP/JSP,其次就是缺乏完善的纠错/调试功能,这点上ASP/PHP/JSP差不多。
兰色精灵 该用户已被删除
地板
发表于 2015-1-30 07:33:42 | 只看该作者
ASP是把代码交给VBScript解释器或Jscript解释器来解释,当然速度没有编译过的程序快了。
小魔女 该用户已被删除
5#
发表于 2015-2-6 08:31:59 | 只看该作者
主流网站开发语言之ASP:ASP是微软(Microsoft)所开发的一种后台脚本语言,它的语法和VisualBASIC类似,可以像SSI(ServerSideInclude)那样把后台脚本代码内嵌到HTML页面中。虽然ASP简单易用,但是它自身存在着许多缺陷,最重要的就是安全性问题。
变相怪杰 该用户已被删除
6#
发表于 2015-2-15 20:28:27 | 只看该作者
Servlet的形式和前面讲的CGI差不多,它是HTML代码和后台程序分开的。它们的启动原理也差不多,都是服务器接到客户端的请求后,进行应答。不同的是,CGI对每个客户请求都打开一个进程(Process)。
活着的死人 该用户已被删除
7#
发表于 2015-3-4 13:29:59 | 只看该作者
asp.net最主要特性包括:◆编程代码更简洁◆网站可实现的功能更强大◆运行效率高◆节省服务器的动作资源
小妖女 该用户已被删除
8#
发表于 2015-3-11 19:49:58 | 只看该作者
碰到复杂点的问题都不知道能不能解决,现在有点实力的公司都选择自已在开源的基础上做开发。但没听说过有人在IIS上做改进的,windows、sqlserver集群方面的应用也很少见。
蒙在股里 该用户已被删除
9#
发表于 2015-3-19 10:41:35 | 只看该作者
通过这次激烈的讨论,我从大家身上学到了太多,开阔了眼界,不管是支持我的还是骂我的,都感谢你们。
愤怒的大鸟 该用户已被删除
10#
发表于 2015-3-27 20:11:52 | 只看该作者
平台无关性是PHP的最大优点,但是在优点的背后,还是有一些小小的缺点的。如果在PHP中不使用ODBC,而用其自带的数据库函数(这样的效率要比使用ODBC高)来连接数据库的话,使用不同的数据库,PHP的函数名不能统一。这样,使得程序的移植变得有些麻烦。不过,作为目前应用最为广泛的一种后台语言,PHP的优点还是异常明显的。
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|Archiver|手机版|仓酷云 鄂ICP备14007578号-2

GMT+8, 2024-5-4 22:29

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表