ASP教程之在ASP中不缓存页面
实现规模效益。与传统的用户拥有硬件软件所有权和使用权以及传统的应用服务商提供一对一的服务模式不同,ASP拥有应用系统所有权,用户拥有使用权,应用系统集中放在ASP的数据中心中,集中管理,分散使用,以一对多的租赁的形式为众多用户提供有品质保证的应用技术服务,实现规模效益。缓存|页面|缓存Update1/8/2004Atthetopofthepage:
<%
pStr="private,no-cache,must-revalidate"
Response.ExpiresAbsolute=#2000-01-01#
Response.AddHeader"pragma","no-cache"
Response.AddHeader"cache-control",pStr
%>
--------------------------------------------------------------------------------
Dontallowyourpagetobecached.Why?Youmightwanttopreventusersfromseeingoldcontent.Insertthefollowingcodeinthe<HEAD>tagofyourdocument.
<metahttp-equiv="Expires"content="Tue,04-Dec-199321:29:02GMT">
CacheNoMore(ASP)
byPhilPaxton
(Phil@matchw.com)
HerearethethingsdealingwiththeissueofcachinginASP:
1.Response.Expires=0
2.Response.ExpiresAbsolute=Now()-1
3.Response.AddHeader"cache-control","private"
4.Response.AddHeader"pragma","no-cache"
5.Addinga"cachebuster"bycreatingauniqueURL.
Notes:
#1issaidtoexpireat60seconds,not0.Also,KhinZaw(fromActiveServerPages@andASPAdvanced@)haspostedresearchfromtimespentwithsomeIISinternalsexpertsrevealingthiscanbeaverytouchyparametertorelyuponandusuallyrequiresarather"large"negativenumberorpedantically,thatwouldbeaverysmallnumber).
#2(myowncreation)says"expirethispage24hoursago",allowingfortimedifferences,ratherthanspecifyastaticdate.
#3,#4fromanMSKBarticle.Thecodeiscorrectbuttherearesomeincorrectstatementsinthearticleitself.
n.b.somerelatedKBarticlesinclude:
(INFO:ControllingtheCachingofWebPageswithIIS4.0)
(PRB:BrowserDoesntShowMostRecentVersionsofhtm/aspFiles)
(HowtoUsePragma:No-cachewithIISandIE)
#5myterm,butnotmytechnique.IE5.0candefeat#1-#4usedinconjunctionbutadding#5willbreakit.Iusuallyusesomethinglike"?NoCache=Rnd"afterastatement.BillWilkinson(ofChili!Soft)hasproposedanalternateof?NoCache=Server.URLEncode(Now())".
--------------------------------------------------------------------------------
Anotherthingtoremember:Netscapewillcontinuetocache,evenifyouturnallcachingoff.Thisbehaviorpersistedthrough4.5PR1,PR2,andnowinthereleasedversionof4.5.
Ifyoufearyoumighthavetodealwithcachinglater,youmightwanttobuildcontingenciesintoyourappasyougo.Retrofitting#5throughoutevenamedium-sizedappwouldtakearathersizeableeffort.Youcouldretrofit#1-#4(inclusive)ratherquicklywithasinglepassthroughtheapplication,but#5takesalotofextraeffort.Andtothatend,IdonteverResponse.RedirectanywhereinmycodeexceptsamplecodeIposttothelists(thenagain,theonlytimeIuseResponse.WriteistothelistbecauseIrelyonmyUtilities-Form.inclibraryforDisplay()andHTML()).EverythingisRedirect(NewURL)wheretheRedirectfunctionlookslikethis:
FunctionRedirect(NewURL)
IfNotIsEmpty(NewURL&"")Then
DimQuestionMark
QuestionMark=Instr(NewURL,"?")
IfQuestionMark=0Then
Response.RedirectNewURL&"?"&NoCacheURL()
Response.End
Else
Response.RedirectNEWURL&"&"&NoCacheURL()
Response.End
EndIf
EndIf
EndFunction
andNoCacheURLlookslikethis:
FunctionNoCacheURL()
OnErrorResumeNext
Randomize
RandomizenotneededifyouuseNow()
NoCacheURL="NoCache="&Server.URLEncode(rnd)
orNoCacheURL="NoCache="&Server.URLEncode(Now())
perBill
EndFunction</p>只要你想学,就没什么优缺点,上面那位大哥已经把网上的评论说了,但我认为想学哪个都一样,不然它就不可能在当今时代数字艺术方面存活到今天 虽然ASP也有很多网络教程。但是这些都不系统。都是半路出家,只是从一个例子告诉你怎么用。不会深入讨论,更不会将没有出现在例子里的方法都一一列举出来。 以上是语言本身的弱点,在功能方面ASP同样存在问题,第一是功能太弱,一些底层操作只能通过组件来完成,在这点上是远远比不上PHP/JSP,其次就是缺乏完善的纠错/调试功能,这点上ASP/PHP/JSP差不多。 我可以结合自己的经验大致给你说一说,希望对你有所帮助,少走些弯路。 完全不知道到底自己学的是什么。最后,除了教程里面说的几个例子,还是什么都不会。 不是很难但是英文要有一点基础网上的教程很少有系统的详细的去买书吧,另不用专门学习vb关于vbscript脚本在asp教材都有介绍 还有如何才能在最短的时间内学完?我每天可以有效学习2小时,双休日4小时。 虽然ASP也有很多网络教程。但是这些都不系统。都是半路出家,只是从一个例子告诉你怎么用。不会深入讨论,更不会将没有出现在例子里的方法都一一列举出来。 哪些内置对象是可以跳过的,或者哪些属性和方法是用不到的?
页:
[1]