毕业设计论文翻译材料.docx
《毕业设计论文翻译材料.docx》由会员分享,可在线阅读,更多相关《毕业设计论文翻译材料.docx(13页珍藏版)》请在冰豆网上搜索。
毕业设计论文翻译材料
毕业设计(论文)翻译材料
学院:
专业:
班级:
学生姓名:
指导教师:
ASP.NETTechnique
1.BuildingASP.NETPages
ASP.NETandthe.NETFramework
ASP.NETispartofMicrosoft'soverall.NETframework,whichcontainsavastsetofprogrammingclassesdesignedtosatisfyanyconceivableprogrammingneed.Inthefollowingtwosections,youlearnhowASP.NETfitswithinthe.NETframework,andyoulearnaboutthelanguagesyoucanuseinyourASP.NETpages.
The.NETFrameworkClassLibrary
ImaginethatyouareMicrosoft.Imaginethatyouhavetosupportmultipleprogramminglanguages—suchasVisualBasic,JScript,andC++.Agreatdealofthefunctionalityoftheseprogramminglanguagesoverlaps.Forexample,foreachlanguage,youwouldhavetoincludemethodsforaccessingthefilesystem,workingwithdatabases,andmanipulatingstrings.
Furthermore,theselanguagescontainsimilarprogrammingconstructs.Everylanguage,forexample,canrepresentloopsandconditionals.EventhoughthesyntaxofaconditionalwritteninVisualBasicdiffersfromthesyntaxofaconditionalwritteninC++,theprogrammingfunctionisthesame.
Finally,mostprogramminglanguageshavesimilarvariabledatatypes.Inmostlanguages,youhavesomemeansofrepresentingstringsandintegers,forexample.Themaximumandminimumsizeofanintegermightdependonthelanguage,butthebasicdatatypeisthesame.
Maintainingallthisfunctionalityformultiplelanguagesrequiresalotofwork.Whykeepreinventingthewheel?
Wouldn'titbeeasiertocreateallthisfunctionalityonceanduseitforeverylanguage?
The.NETFrameworkClassLibrarydoesexactlythat.Itconsistsofavastsetofclassesdesignedtosatisfyanyconceivableprogrammingneed.Forexample,the.NETframeworkcontainsclassesforhandlingdatabaseaccess,workingwiththefilesystem,manipulatingtext,andgeneratinggraphics.Inaddition,itcontainsmorespecializedclassesforperformingtaskssuchasworkingwithregularexpressionsandhandlingnetworkprotocols.
The.NETframework,furthermore,containsclassesthatrepresentallthebasicvariabledatatypessuchasstrings,integers,bytes,characters,andarrays.
Mostimportantly,forpurposesofthisbook,the.NETFrameworkClassLibrarycontainsclassesforbuildingASP.NETpages.Youneedtounderstand,however,thatyoucanaccessanyofthe.NETframeworkclasseswhenyouarebuildingyourASP.NETpages.
UnderstandingNamespaces
Asyoumightguess,the.NETframeworkishuge.Itcontainsthousandsofclasses(over3,400).Fortunately,theclassesarenotsimplyjumbledtogether.Theclassesofthe.NETframeworkareorganizedintoahierarchyofnamespaces.
ASPClassicNote
InpreviousversionsofActiveServerPages,youhadaccesstoonlyfivestandardclasses(theResponse,Request,Session,Application,andServerobjects).ASP.NET,incontrast,providesyouwithaccesstoover3,400classes!
Anamespaceisalogicalgroupingofclasses.Forexample,alltheclassesthatrelatetoworkingwiththefilesystemaregatheredtogetherintotheSystem.IOnamespace.
Thenamespacesareorganizedintoahierarchy(alogicaltree).AttherootofthetreeistheSystemnamespace.Thisnamespacecontainsalltheclassesforthebasedatatypes,suchasstringsandarrays.Italsocontainsclassesforworkingwithrandomnumbersanddatesandtimes.
Youcanuniquelyidentifyanyclassinthe.NETframeworkbyusingthefullnamespaceoftheclass.
System.IO.File
System.IOreferstothenamespace,andFilereferstotheparticularclass.
StandardASP.NETNamespaces
TheclassescontainedinaselectnumberofnamespacesareavailableinyourASP.NETpagesbydefault.(Youmustexplicitlyimportothernamespaces.)ThesedefaultnamespacescontainclassesthatyouusemostofteninyourASP.NETapplications:
System—Containsallthebasedatatypesandotherusefulclassessuchasthoserelatedtogeneratingrandomnumbersandworkingwithdatesandtimes.
System.Collections—Containsclassesforworkingwithstandardcollectiontypessuchashashtables,andarraylists.
System.Collections.Specialized—Containsclassesthatrepresentspecializedcollectionssuchaslinkedlistsandstringcollections.
System.Configuration—Containsclassesforworkingwithconfigurationfiles(Web.configfiles).
System.Text—Containsclassesforencoding,decoding,andmanipulatingthecontentsofstrings.
System.Text.RegularExpressions—Containsexpressionmatchandreplaceoperations.
System.Web—ContainsthebasicclassesforworkingwiththeWorldWideWeb,includingclassesforrepresentingbrowserrequestsandserverresponses.
System.Web.Caching—Containsclassesusedforcachingthecontentofpagesandclassesforperformingcustomcachingoperations.
System.Web.Security—ContainsclassesforimplementingauthenticationandauthorizationsuchasFormsandPassportauthentication.
System.Web.SessionState—Containsclassesforimplementingsessionstate.
System.Web.UI—ContainsthebasicclassesusedinbuildingtheuserinterfaceofASP.NETpages.
System.Web.UI.HTMLControls—ContainstheclassesfortheHTMLcontrols.System.Web.UI.WebControls—ContainstheclassesfortheWebcontrols.
.NETFramework-CompatibleLanguages
Forpurposesofthisbook,youwillwritetheapplicationlogicforyourASP.NETpagesusingVisualBasicasyourprogramminglanguage.ItisthedefaultlanguageforASP.NETpages.AlthoughyousticktoVisualBasicinthisbook,youalsoneedtounderstandthatyoucancreateASP.NETpagesbyusinganylanguagethatsupportsthe.NETCommonLanguageRuntime.Outofthebox,thisincludesC#,JScript.NET,andtheManagedExtensionstoC++.classesforperformingregular
IntroducingASP.NETControls
ASP.NETcontrolsprovidethedynamicandinteractiveportionsoftheuserinterfaceforyourWebapplication.ThecontrolsrenderthecontentthattheusersofyourWebsiteactuallyseeandinteractwith.Forexample,youcanusecontrolstocreateHTMLformelements,interactivecalendars,androtatingbanneradvertisements.
ASP.NETcontrolscoexistpeacefullywithHTMLcontent.Typically,youcreatethestaticareasofyourWebpageswithnormalHTMLcontentandcreatethedynamicorinteractiveportionswithASP.NETcontrols.
ThebestwaytounderstandhowASP.NETcontrolsworkinanHTMLpageistolookatasimpleWebFormsPage.
AddingApplicationLogictoanASP.NETPage
ThesecondbuildingblockofanASP.NETpageistheapplicationlogic,whichistheactualprogrammingcodeinthepage.Youaddapplicationlogictoapagetohandlebothcontrolandpageevents.
IfauserclicksaButtoncontrolwithinanHTMLform,forexample,theButtoncontrolraisesanevent(theClickevent).Typically,youwanttoaddcodetothepagethatdoessomethinginresponsetothisevent.Forexample,whensomeoneclickstheButtoncontrol,youmightwanttosavetheformdatatoafileordatabase.
Controlsarenottheonlythingsthatcanraiseevents.AnASP.NETpageitselfraisesseveraleventseverytimeitisrequested.Forexample,wheneveryourequestapage,thepage'sLoadeventistriggered.YoucanaddapplicationlogictothepagethatexecuteswhenevertheLoadeventoccurs.
2.BuildingFormswithWebServerControls
BuildingSmartForms
YouuseseveralofthebasicWebcontrolstorepresentstandardHTMLformelementssuchasradiobuttons,textboxes,andlistboxes.YoucanusethesecontrolsinyourASP.NETpagestocreatetheuserinterfaceforyourWebapplication.ThefollowingsectionsprovidedetailedoverviewsandprogrammingsamplesforeachoftheseWebcontrols.
ControllingPageNavigation
Inthefollowingsections,youlearnhowtocontrolhowausermovesfromoneASP.NETpagetoanother.First,youlearnhowtosubmitanHTMLformtoanotherpageandretrieveforminformation.Next,youlearnhowtousetheRedirect()methodtoautomaticallytransferausertoanewpage.Finally,youlearnhowtolinkpagestogetherwiththeHyperLinkcontrol.
ApplyingFormattingtoControls
Inthefollowingsections,youlearnhowtomakemoreattractiveWebforms.First,youlookatanoverviewoftheformattingpropertiescommontoallWebcontrols;theyaretheformattingpropertiesofthebasecontrolclass.Next,youlearnhowtoapplyCascadingStyleSheetstylesandclassestoWebcontrols.
3.PerformingFormValidationwithValidationControls
UsingClient-sideValidation
Traditionally,Webdevelopershavefacedatoughchoicewhenaddingformvalidationlogictotheirpages.Youcanaddformvalidationroutinestoyourserver-sidecode,oryoucanaddthevalidationroutinestoyourclient-sidecode.
Theadvantageofwritingvalidationlogicinclient-sidecodeisthatyoucanprovideinstantfeedbacktoyourusers.Forexample,ifauserneglectstoenteravalueinarequired
formfield,youcaninstantlydisplayanerrormessagewithoutrequiringaroundtripbacktotheserver.
Peoplereallylikeclient-sidevalidation.Itlooksgreatandcreatesabetteroveralluserexperience.Theproblem,however,isthatitdoesnotworkwithallbrowsers.NotallbrowserssupportJavaScript,anddifferentversionsofbrowserssupportdifferentversionsofJavaScript,soclient-sidevalidationisneverguaranteedtowork.
Forthisreason,inthepast,manydevelopersdecidedtoaddalltheirformvalidationlogicexclusivelytoserver-sidecode.Becauseserver-sidecodefunctionscorrectlywithanybrowser,thiscourseofactionwassafer.
Fortunately,theValidationcontrolsdiscussedinthischapterdonotforceyoutomakethisdifficultchoice.TheValidationcontrolsautomaticallygeneratebothclient-sideandserver-sidecode.IfabrowseriscapableofsupportingJavaScript,client-sidevalidationscriptsareautomaticall