Writeaspweb服务器

aspweb服务器  时间:2021-04-14  阅读:()
Chapter5ProgrammingtheWebServer-sideProgrammingASP.
NETWebFormsYingcaiXiaoServer-sideProgrammingASP.
NETWEBSERVERIISWEBCLIENTApplication3Application2Application1ASP.
NETHTTPWeb&ApplicationServersWebServerWeberserverhardwarehoststhewebserversoftware.
WebserversoftwarelistenstoHTTPrequestsfromthewebport(80).
Itprocessestherequestedpre-deployedwebpage.
Microsoftwebserver:IIS(InternetInformationServer)DeployingaWebPageonanIISserver.
IIS:InternetInformationServicesDeployingDirectory:C:\Inetpub\wwwrootAccessURL(localontheserver):http://localhost/(caseinsensitive)AccessURL(remotelyfromaclient):http://hostname/(caseinsensitive)Example:DeploymentC:\Inetpub\wwwroot\xiaotest/calc.
htmlAccesshttp://localhost/xiaotest/calc.
htmlhttp://winserv1.
cs.
uakron.
edu/xiaotest/calc.
htmlApplicationServerCommonGatewayInterface(CGI)CGIapplicationswriteHTTPresponsestostandardoutput(stdout)ontheserver,whicharethenforwardedtotheclientbrowserbythewebserver.
CGIdefinesalow-levelprogrammaticinterfacebetweenWebserversandapplicationsthatrunonWebservers.
CGIapplicationscanbewritteninanyprogramminglanguage.
CGIapplicationsreadtheinputaccompanyingpostbacksthroughserverenvironmentvariablesandstandardinput(stdin).
Slow,restartsaprocessoneveryrequest.
ISAPIISAPI:InternetServerApplicationProgrammingInterfaceISAPIextensionsareWindowsDLLshostedbyIIS.
They'rereferencedbyURLjustlikeHTMLfiles(forexample,http://winserv1.
cs.
uakron.
edu/xiaotest/calc.
dll).
IISforwardsHTTPrequeststoanISAPIDLLbycallingaspecialfunctionexportedfromtheDLL.
TheDLLgeneratesHTTPresponses.
FasterthanCGI(runinthesameprocessasIIS).
Onceloaded,theyremaininmemory.
They'redifficulttowrite.
ActiveServerPages(ASP)ActiveServerPages(ASP)Introducedin1996.
DynamicallygeneratesHTMLonWebservers.
AllowsHTMLandscripts/languagestobemixed.
Theembeddedscriptcodearebetweenthetags.
WhenanActiveServerPageisrequested,ASPserverparsesthepageandexecutesanyscriptscontainedinsideit.
ScriptsaccesstheinputbyusingtheRequestobject.
ScriptswriteHTMLtotheHTTPresponseusingtheResponseobject,whichissenttotheclientbytheWebserveralongwiththestaticHTML.
ASPintegrateswithActiveXDataObjects(ADO).
Interpreted,slow.
Lacksencapsulation.
Calc.
aspAPS.
NETASP:Microfoft'sequivalentofJSPCodeontheserverthatdynamicallygeneratesHTMLfortheclientsatruntime.
JSP:JavaServerPageJavacodeontheserverthatgeneratesHTMLfortheclients.
HTMLcontentscanbedynamicallygeneratedatruntimeASP.
NET:ASPbasedonthe.
NETframework,oneofthemostpopularwebprogrammingtechniques.
CodeontheserverthatdynamicallygeneratesHTMLfortheclientsatruntime.
http://www.
asp.
net/get-startedhttp://www.
w3schools.
com/aspnet/https://mva.
microsoft.
com/en-US/training-courses/introduction-to-aspnet-5-13786https://mva.
microsoft.
com/en-US/training-courses/introduction-to-asp-net-mvc-8322l=nKZwZ8Zy_3504984382EnablingIISASP.
NETneedstobeinstalledonthehostserverwithIISenabled.
EnablingIISforWin8&10:https://www.
youtube.
com/watchv=fVHwyiy_LgAhttp://www.
howtogeek.
com/112455/how-to-install-iis-8-on-windows-8/forWin7&2003WinServer:http://windows.
microsoft.
com/en-us/windows7/install-internet-information-services-iis-7-5https://msdn.
microsoft.
com/en-us/library/ms181052%28v=vs.
80%29.
aspxInstallASP.
NETForWindowshttp://docs.
asp.
net/en/latest/getting-started/installing-on-windows.
htmlhttps://www.
youtube.
com/watchv=RjPwAV1RVMQForWindowsServershttps://technet.
microsoft.
com/en-us/library/hh831475.
aspxASP.
NETApplicationDeploymentandAccessApplicationDeploymentC:\Inetpub\wwwroot\xiaotest/calc.
aspxAccesshttp://localhost/xiaotest/calc.
htmlhttp://winserv1.
cs.
uakron.
edu/xiaotest/calc.
aspxvoidOnAdd(Objectsender,EventArgse)inta=Convert.
ToInt32(op1.
Text);intb=Convert.
ToInt32(op2.
Text);Sum.
Text=(a+b).
ToString();}Calc.
aspxASP.
NETWebFormsWebFormsWebFormsareGUI-basedEDPwebpagesbuiltaroundcontrolsandeventhandlers.
.
NETwebformsareprocessedontheserversidebytheASP.
NETapplicationserver.
WebformsuseHTML,HTTPandIPtotransmitanddisplayGUIintoaclientweb-browser.
ASP.
NETWebFormsGUIforWebapplicationsObject-oriented(encapsulation,inheritance,polymorphism)Eventdriven(EDP)Server-sideprocessing(dynamicgenerationofHTML)Compiledcode,fasterHTMLembeddingtag:(processedontheserverside)Fileextension:.
aspxTodeployonwinserv1:copyExamples/c5/calc.
aspxtoC:\Inetpub\wwwroot\xiaotestToaccess:http://winserv1.
cs.
uakron.
edu/xiaotest/calc.
aspxASP.
NETWebFormsASP.
NETWEBSERVERIISWEBCLIENTApplication3Application2Application1ASP.
NETHTTPvoidOnAdd(Objectsender,EventArgse)inta=Convert.
ToInt32(op1.
Text);intb=Convert.
ToInt32(op2.
Text);Sum.
Text=(a+b).
ToString();}Calc.
aspxWhenCalc.
aspxisaccessedbyaclientAnASP.
NETserverpagecontainstwoparts:staticHTMLcodeanddynamicembeddedAPS.
NETcode.
ASP.
NET-enabledwebserverprocessestheASP.
NETcodeintheserverpage.
(TomcatdoesnotsupportASP.
NETbutMonodoes)ItinstantiatesTextBox,Button,andLabelobjects(theclassesaredefinedinSystem.
Web.
UI.
WebControls).
EachobjectdynamicallyrendersitselfintoHTML.
ThedynamicallygeneratedHTMLismergedintothestaticHTML.
TheresultingHTMLisreturnedtotheclientasanHTTPresponse.
Calc.
aspxasseenbytheclientnote:therearealso"hidden"and"div"(section)tags.
Whenthe"="buttonisclicked,theinputfrom"op1"and"op2"arepostedtotheserveranddirectedtocalc.
aspx(sinceaction="calc.
aspx").
Ontheserverside,ASP.
NETnotifiestheButtonobjectincalc.
aspxandtheButtonrespondsbyfiringaClickevent.
ASP.
NETreceivestheeventandsubsequentlyinvokesitshandler:OnAdd().
"Sum.
Text=(a+b).
ToString();"renderstheresultintothe"Sum"labelinasHTML.
ThedynamicallygeneratedHTMLismergedwiththestaticHTML(partsnotinserversidetags).
TheresultingHTMLissenttotheclientbrowser.
Usetheclientbrowser'sView->PageSourcemenutoseethefinalHTMLcodereceivedbytheclient.
(Mac/Crome:View->Developer->ViewPageSourceWhenCalc.
aspxisaccessedbyaclientASP.
NETControlsTwotypes:WebControlsandHTMLControlsWebControlsClassnamesareprefixedwithasp:.
ClassesarefromSystem.
Web.
UI.
WebControls.
ThenameoftheobjectisdefinedbytheIDattribute.
ASPWebcontrolsarerenderedintoHTML.
ASPWebcontrolsarehighlyprogrammable.
Theysupportmethods,properties,events.
Thiswebcontrolinitializesthetextboxtodisplay2.
Anypublicpropertyofacontrolcanbeusedthisway.
ASP.
NETControlsControlpropertiescanbeaccessedfromserver-sidescripts(codebetweentheandtags).
Readacontrolpropertybyscripts:inta=Convert.
ToInt32(op1.
Text);Writeacontrolpropertybyscripts:Sum.
Text=(a+b).
ToString();Event-drivenprogramming.
Controlsfireeventswhenusersclickonthem.
Wiringaneventtoaneventhandlerisaccomplishedbyprefixingtheeventnamewith"On".
Exceptionhandlingcanbeaddedinthehandlers.
voidOnAdd(Objectsender,EventArgse){tryinta=Convert.
ToInt32(op1.
Text)intb=Convert.
ToInt32(op2.
Text)Sum.
Text=(a+b).
ToStringcatch(FormatException)Sum.
Text="FormatError";}}ASP.
NETControlsThreeprinciplesoftheWebFormsprogrammingmodel:AWebform'suserinterfaceis"declared"usingacombinationofHTMLandservercontrols.
Servercontrolsfireeventsthatcanbehandledbyserver-sidescripts.
Server-sidescriptsinASP.
NETarecompiledtoCILandexecutedbytheCLRontheserver.
RunAt="server"mustbeusedineverytagthatASP.
NETistoprocessTheWebFormsProgrammingModelWebControlsAdRotatorDisplaysrotatingbannersinWebformsButtonGeneratessubmitbuttonsCalendarDisplayscalendarswithselectabledatesCheckBoxDisplaysacheckboxinaWebformCheckBoxListDisplaysagroupofcheckboxesCompareValidatorValidatesuserinputbycomparingittoanothervalueCustomValidatorValidatesuserinputusingthealgorithmofyourchoiceWebControlsDataGridDisplaysdataintabularformatDataListDisplaysitemsinsingle-columnormulticolumnlistsusingHTMLtemplatesDropDownListGeneratesHTMLdrop-downlistsHyperLinkGenerateshyperlinksImageDisplaysimagesinWebformsImageButtonDisplaysgraphicalpushbuttonsLabelGeneratesprogrammabletextfieldsLinkButtonGenerateshyperlinksthatpostbacktotheserverWebControlsListBoxGeneratesHTMLlistboxesLiteralGeneratesliteraltextinaWebformPanelGroupsothercontrolsRadioButtonDisplaysaradiobuttoninaWebformRadioButtonListDisplaysagroupofcheckboxesRangeValidatorVerifiesthatuserinputfallswithinaspecifiedrangeRegularExpressionValidatorValidatesuserinputusingregularexpressionsRepeaterDisplaysitemsusingHTMLtemplatesWebControlsRequiredFieldValidatorVerifiesthataninputfieldisn'temptyTableGeneratesHTMLtablesTextBoxGeneratestextinputfieldsValidationSummaryDisplaysasummaryofvalidationerrorsXmlDisplaysXMLdocumentsandoptionallyformatsthemusingXSLTASP.
NETHTMLcontrolsmimictheoriginalHTMLtags.
(Theyareprocessedontheserverside.
TheyarenotHTMLtagswhichareprocessedbytheclientbrowser.
)e.
g.
HTMLcontrolsareusedlikeHTMLtags.
AnHTMLcontrolisaninstanceofSystem.
Web.
UI.
HtmlControls.
HtmlInputText.
ASP.
NETseestheRunAt="server"attributeandcreatesanHtmlInputTextobject.
TheHtmlInputTextobject,inturn,emitsantagthat'sultimatelyreturnedtothebrowser.
HTMLcontrols(serverside)havepropertiesandcangenerateeventswhichmakethemmorepowerfulthanHTMLtags(clientside).
WithoutRunAt="server",HTMLcontrolsbecomeHTMLtags.
HTMLControlsHTMLControlsTagCorrespondingHTMLControlHtmlAnchorHtmlButtonHtmlFormHtmlImageHtmlInputButtonHtmlInputButtonHtmlInputButtonHTMLControlsHtmlInputCheckBoxHtmlInputFileHtmlInputHiddenHtmlInputImageHtmlInputRadioButtonHtmlInputPasswordHtmlInputTextHtmlSelectHTMLControlsHtmlTableHtmlTableCellHtmlTableCellHtmlTableRowHtmlTextAreaAnyothertagwithrunat="server"HtmlGenericControlvoidOnAdd(Objectsender,EventArgse){inta=Convert.
ToInt32(op1.
Value);intb=Convert.
ToInt32(op2.
Value);Sum.
InnerText=(a+b).
ToString();}TheHTMLcontrolsversionofCalc.
aspxTheInnerWorkingofASP.
NETWhenASP.
NETprocessesthefirstHTTPrequestforanASPXfile:Itcreatesclassrepresentingthedynamiccodeofthefile.
Itcompilesit,loadsit,createsanobjectforit.
Theobjectinitializesitselfandprocessespage-levelevents.
TheobjectgeneratesHTMLoutputtobesenttotheclient.
Theobjectremainsintheservermemorytoprocessfurtherrequeststothepage.
WhentheASPXfileismodify,ASP.
NETautomaticallyrepeatssteps1-4.
HowdoesanASP.
NETenabledserverprocessanASPXfileWhenASP.
NETprocessesthefirstHTTPrequestforanASPXfile:1.
ItcreatesaPageclassderivingfromclassSystem.
Web.
UI.
Page.
2.
ItcopiesthecodeintheASPXfiletothePage-derivedclass.
3.
Amethod(e.
g.
OnAdd)inablockbecomesamembermethodofthederivedclass.
ASP.
NETcompilesthederivedclassandplacestheresultingDLLinasystemfolderandcachesitthere.
C:\Windows\Microsoft.
NET\Framework\vn.
n.
nnnn\TemporaryASP.
NETFiles.
5.
ASP.
NETinstantiatesanobjectofthederivedPageclassand"executes"itbycallingaseriesofmethodsonit.
6.
ThePageobjectinstantiatesanycontrolsdeclaredinsideitandsolicitstheiroutput.
HowdoesaASP.
NETenabledserverprocessanASPXfile(Details)AsthePageobjectexecutes,itfiresaseriesofevents(page-levelevents)thatcanbeprocessedbyserver-sidescripts:"Init",whichisfiredwhenthepageisfirstinstantiated(forthisandotherfutureclients.
)"Load",whichisfiredafterthepage'scontrolsareinitializedbutbeforethepagerendersanyoutput(foreachclient).
ImplicitwiringofPageeventstohandlersbydefininghandlers'namesasPage_EventName.
voidPage_Load(Objectsender,EventArgse){if(!
IsPostBack){//ifitisnotfromtheclient(firstload)for(inti=0;iPage-LevelEventsASP.
NETCompilationDirectives@@PageDefinesgeneralattributesandcompilationsettingsforASPXfiles(e.
g.
Language)@ControlDefinesgeneralattributesandcompilationsettingsforASCXfiles@ImportImportsanamespace@AssemblyEnableslinkagetoassemblies,notlinkedtobydefault@RegisterRegistersusercontrolsandcustomcontrolsforuseinaWebform@OutputCacheExertsdeclarativecontroloverpagecachingandfragmentcaching@ReferenceAddsareferencetoanexternalASPXorASCXfile@ImplementsIdentifiesaninterfaceimplementedbyaWebpageMustbepositionedatthetopofanASPXfile.
ASPXfilesaretextfiles,anyonecanreadit.
WhenacompanysellsitsASPXserverprograms,itdoesnotwantpeopletoseetheirsourcecode.
Code-behindisdesignedtoprotectsourcecode.
ForthestaticcodeinHTML,wecan'tdoanythingaboutit.
DynamiccodeinC#orother.
NETlanguagescanbeseparatedoutandcompiledintoDLLs.
OnlythestaticHTMLcodeandtheDLLsaredeliveredtothecustoms.
TheDLLscanbewritteninanyserver-sideprogramminglanguagessupportedby.
NET.
SeparatingStaticCodefromDynamicCode1.
CreateaCSfile(e.
g.
Examples/C5/Lander/LanderDLL.
cs)containingcodethatwouldnormallyappearbetweenandtags.
Makeeachofthesesourcecodeelementsmembersofaclass(e.
g.
LanderPage)derivedfromSystem.
Web.
UI.
Page.
2.
InyourPage-derivedclass,declareprotectedfieldswhosenamesmirrortheIDsofthecontrolsdeclaredintheASPXfile(e.
g.
LanderCB.
aspx).
Atruntime,ASP.
NETmapsthesefieldstothecontrolsofthesamenames.
CompiletheCSfileintoaDLL.
InaVisualStudioCommandPromptwindow,runthefollowing:csc/target:libraryLander.
csCode-behindwithC#4.
PlacetheHTMLportionoftheWebform—everythingbetweentheandtags—inanASPXfile(e.
g.
LanderDLL.
aspx).
5.
IncludeintheASPXfilean@PagedirectivecontaininganInheritsattributethatidentifiesthePage-derivedclassintheDLL.
Whenarequestarrivesforthatpageatrun-time,ASP.
NETderivesachildclassfromthisclasstocreatetheform.
e.
g.
7.
CodeembeddedhavetobeinC#,VB.
NET,orJScript.
Code-behindcanbeinanyotherlanguagesupportedby.
NET.
Code-behindinWebformscodedinC#Todeploytheprogram:movetheASPXfiletoInetpub/wwwroot/xiaotest/Lander(oryourpublishingdirectory:inetpub/wwwroot/semester/yourID)andtheDLLtoInetpub/wwwroot/xiaotest/Lander/bin.
(inetpub/wwwroot/semester/yourID)TheprogramcanbeaccessedthesamewayasotherASP.
NETprograms:http://winserv1.
cs.
uakron.
edu/xiaotest/Lander/LanderDLL.
aspx(http://winserv1.
cs.
uakron.
edu/semester/yourID/LanderDLL.
aspx)Code-behindinWebformscodedinC#Inorderforhttp://winserv1.
cs.
uakron.
edu/xiaotest/Lander/LanderDLL.
aspxtowork,theLanderdirectoryhastobeconvertedtoaWebApplication,whichinstructsASP.
NETtofindLander.
dllundertheapplication'sbindirectory.
(Thisisdoneforyourhomedirectoryonwinserv1:inetpub/wwwroot/semester/yourID))Code-behindinWebformscodedinC#Tousethesourcecodewithoutrecompilingduringdevelopment:CopyLander.
cstoLanderSRC.
csRenametheclassinitfromLanderPagetoLanderSRCPagepublicclassLanderSRCPage:PageCopyLanderDLL.
aspxtoLanderSRC.
aspxRenametheclasstoinheritandaddthesourcefile.
YouhavetorenametheclassotherwiseitwouldconflicttheclassnameincodebehindandgetanerrorBC30456:'InitializeCulture'isnotamemberof.
.
.
http://winserv1.
cs.
uakron.
edu/xiaotest/Lander/LanderSRC.
aspxCode-behindinWebformscodedinC#SettingUpaFolderforWebAccessRightclickonthefolderinFileExplorer,selectPropertiesSelecttheSecurityTabEdit->AddIUSR(cslabs.
cs.
uakron.
edu)IIS_IUSRS(WINSERV1)Givethemthefollowingpermissions:Read&executeListfoldercontentReadInordertosupportCodeBehind,afolderneedstobeconvertedintoanWebApplication,sothatASP.
NETknowswheretofindDLLsintheitsbindirectory.
CreateaWebApplicationinIIS*YouneedtobeanadministratortouseIISLogintotheserver(WINSERV1)asasystemadministratorStart->AdministrativeTools->ServerManager(oftheOS)ServerManager(WINSERV1)->Roles->WebServer(IIS)->InternetInformationService(IIS)ManagerConnections->WINSERV1(CS\xiao)->Sites->DefaultWebSiteSelectanapplicationfolder(xiaotest\Lander)Right-click->ConverttoApplicationAlias:LanderApplicationpool:defualtAppPoolPhysicalpath:C:\inetpub\wwwroot\xiaotest\LanderURL:http://winserv1.
cs.
uakron.
edu/xiaotest/LanderDevelopmentofWebformsusingVisualStudio.
NETCreateaWebApplicationprojectSettheURLforpublishingUseformsdesignertodesignformsbydrag-and-dropcontrolsfromapaletteontotheforms.
EdittheHTML.
Writeeventhandlersbydouble-clickingcontrolsandfillinginemptymethodbodies.
Compileandrunapplicationsbyexecutingsimplemenucommands.
WebFormsandVisualStudio.
NETUndertheHoodofIISYingcaiXiaoWhatistheInternetProgrammingtheInternetTheInternetisanetworkofComputersconnectedviatheInternetProtocols(IP)Internet:interconnectednetworkTheInternetcanbetreatedasa"Computer".
EverycomputerontheInternetisa"CPU".
TransmittingdataovertheInternetistheKey.
AnalogyofInternetProtocols:IP(InternetProtocol)=>"Binary"(low-levelInternettransmissionprotocol)HTTP(HyperTextTransportProtocol)=>"IntermediateLanguage"(high-levelInternettransmissionprotocol)HTML(HyperTextMarkupLanguage)=>HighLevelLanguage(forwritingweb-pagesin)WhatistheInternetProtocolInternetProtocolIP:InternetProtocol:Thedatatransmissionprotocol(standard)fortheInternet.
DARPAVintCerfandBobKahnin1974TheInternetisacomputernetworkbasedontheInternetProtocol.
EachdeviceontheInternetisidentifiedbyitsInternetAddress:130.
101.
10.
31orwinserv1.
cs.
uakron.
eduDatatransmittedbetweencomputersaspackets.
EachpackethasanIPheaderfollowedbydata.
Thefirst2entriesinanIPheaderarethereceiver'saddressandthesender'saddress.
IPissimilartopostalmailing(PacketSwitching),notphoning(CircuitSwitching).
Routers/Gatewaysforwardpacketsbasedonnetworktopologyandtraffic.
IPv4(32bitaddressing,4B),IPv6(48bitaddressing,256T)TheheadersareinthestandardIPformat,platform-independent.
Data(anytype)istransmittedovertheInternetbit-by-bit.
Norestrictionsonwhatcanbetransmitted.
InternetProtocolMoreonIPAnyIPdevicecanjoinanddropofftheInternetatanytime.
(NotsoforIBM'stokenringnetworks.
)Packetsreceivedmaynotintheordertheyweresent.
Waitandsendagainifnetworkisbusy.
Transmissionspeeddecreasesastrafficincreases.
DoSattacks.
Binarydataareplatform-dependent.
Binarydatatransmittedfromonecomputertoanothercomputermaynotbereadablebythereceiverifithasadifferentbinarydataformatthanthesender.
WhatistheWorldWideWebHypertextTransferProtocolCanwemakethedataplatform-independentTheWorldWideWebisanapplicationbuiltontheInternetusingtheHypertextTransferProtocolinwhichonlytextispermittedtobetransmitted.
HTTP(HypertextTransferProtocol)TimBerners-Lee("fatheroftheWeb")andRFC2068(www.
w3.
org/Protocols/rfc2068/rfc2068).
1989.
Entirelytextbased:ASCII(8-bits)orUnicode(16-bits).
PlatformindependentDefineshowWebbrowsersandWebserverscommunicate.
7instructionsdefinedinHTTP1.
1.
:GET,POST,…TransmittedoverTCP/IP(TransportControlProtocol/InternetProtocol).
WebapplicationsareimplementedovertheInternetusingHTMLandotherWeblanguages.
InternetBrowserGETHTMLpagesfromserversDisplaytheHTMLpagesattheclients.
TimBerners-Lee:Thefirstwebbrowser,1990,wascalledWorldWideWebRobertCailliau:Erwise,thefirstcommonlyavailablewebbrowserwithagraphicaluserinterface.
MarcAndreessen:Mosaic,thefirstpopularbrowser,1993,Netscape1994HTML(HypertextMarkupLanguage)DefinessyntaxandsemanticsoftheWeblanguage.
Entirelytextbased(platformindependent)Hypertextsaretaggedin,nottobedisplayed.
Theyaremetadatadescribingregulartext.
(http://www.
w3schools.
com/tags/)BrowsersareGUI-basedHTMLinterpreters.
HTML4.
01becameXHTML1.
0in2000simple.
html:Hello,worldHTMLComputingovertheInternetClient-Side:ThickclientClientprograminstalledprior,noneedtodownloadatruntime.
Runslikeanyotherprogramontheclient,butcantalktotheserverwhenneeded.
.
NETRemoting,WindowsCommunicationFoundation(WCF),Java'sRemoteMethodInvocation(RMI)CommonObjectRequestBrokerArchitecture(CORBA)ComputingovertheInternetClient-Side:ThinclientOnlyabrowserisneeded.
Thebrowserrendersahtmlpageontheclientcomputer.
HTML(static),DHTML(dynamic),HTML5(dynamicandmulti-medium).
Programmingwithembeddedscripts:JavaScript,.
Dynamicandcomputational.
Ajax(asynchronousJavaScript&XML):asynchronous.
Plugins:VRML(3DWeb)JavaApplet:transmittheapplicationtotheclientandrunitthere.
Toomuchtotransmitforlargedistributionlists.
ComputingovertheInternetServer-Side:Webpagesaregeneratedbyserversideprogramsatruntime.
Dynamiccontentsandheavy-dutycomputing.
ServerScriptsPerl,PHP,….
Doesnotscalewell.
(eachclientneedsaprocesstoservice)ServerVMs.
NETASP(ActiveServerPage),JSP(JavaServerPage),Allclientsareservedbyasingleprocess.
Theprocesswillcreateathreadtoserveeachclient.
ComputingovertheInternetServer-Side:CMS(ContentManagementSystems):webcontentsaremanagedatserversideondemand.
DejangoCMS,Joomla.
Server-ClientCommunication:ImportantforInternetbasedcomputing.
HTTPchannel(slower,worksforboththinandthickclients).
TCP/IPchannel(faster,worksonlyforthickclients).
HTTPnext,TCP/IPlater.
ComputingovertheInternetWebClient-ServerCommunicationsovertheInternetWhathappenswhenbrowsingawebpageonaserverhttp://winserv1.
cs.
uakron.
edu/xiaotest/calc.
htmlStartaclient(abrowser).
TypeintheURL(UnifiedResourceLocator).
Internet'sDomainNameSystem(DNS)convertswinserv1.
cs.
uakron.
eduintoanIPaddress(130.
101.
10.
31).
Thebrowseropensasocket(IP)connectiontotheserverusingdefaultport80winserv1.
cs.
uakron.
edu:80WhathappenswhenbrowsingawebpageonaserverThebrowsertransmitsanHTTPrequesttotheserver.
GET/xiaotest/calc.
htmlHTTP/1.
1Accept:*/*Accept-Language:en-usAccept-Encoding:gzip,deflateUser-agent:Mozilla/4.
0.
(compatible;MSIE.
6.
0;WindowsNT5.
1)Host:winserv1.
cs.
uakron.
edu/Connection:Keep-Alive[blankline]WhathappenswhenbrowsingawebpageonaserverTheserversoftware(e.
g.
IIS,Tomcat)processesclientrequestsfromthedesignatedport(80bydefault).
Locatesthefileundertheserver'swebrootdirectory(c:\Inetpub\wwwroot)Returns"ServerError404"iffilenotfound.
Otherwisereturnsthecontentsofthefileastexttotheclientwithatextheader.
WhathappenswhenbrowsingawebpageonaserverTheservertransmitsanHTTPresponseback.
HTTP/1.
1200OKServer:Microsoft-IIS/5.
0Date:Wed,24Oct201414:12:37GMTContent-Type:text/htmlAccept-Ranges:bytesLast-Modified:Wed,24Oct201414:00:53GMTETag:"d02acf81975cc11:a78"Content-Length:4800[blankline]…WhathappenswhenbrowsingawebpageonaserverUponreceivingtheresponse,thebrowserparsestheHTMLanddisplaystheresultingWebpage.
Tocompute,weneedtoobtaindatafromtheclientuser.
Aclientformisneeded.
HTMLformservesthepurpose.
http://winserv1.
cs.
uakron.
edu/xiaotest/calc.
htmlHTMLFormsWhat'shappeningNoactiontosendanythingtotheserverwhentheusertypesvaluesinthetextfields.
Butwhenthesubmitbutton()isclicked,thebrowsersubmitstheformalongwithanyinputintheform'scontrols.
POST/xiaotest/calc.
htmlHTTP/1.
1…Content-Length:11[blankline]op1=2&op2=2WebApplicationClient-ServerCommunicationsovertheInternetASP.
NETWEBSERVERIISWEBCLIENTApplication3Application2Application1ASP.
NETHTTPServerIIS(InternetInformationServices)winserv1webserverS/WwebserverH/WServerIISwinserv1IPport80HTTPClientClientMachineWebBrowserURL:winserv1.
cs.
uakron.
edu/xiaotest/calc.
htmlAddhttp://asdefault1.
2.
Addportnum:80asdefault3.
GettheIPaddressfromtheDNS130.
101.
10.
314.
CreateanIPpacketIPPacket130.
101.
10.
31130.
101.
10.
08HTTPGET/xiaotest/calc.
html------[blankline]5.
Openport80on130.
101.
10.
316.
SendthepacketofHTTPrequestServerComputerIPpacketofHTTPrequestClientComputerServerIISIPPort80HTTPwinserv1HTTPrequestfromtheClient1.
IISretrievesxiaotest/calc.
html2.
IISformsaHTTPresponsepacketServerIISwinserv1IPport80HTTPHDC:/inetpub/wwwroot/ServerIISwinserv1IPport80HTTPHDC:/inetpub/wwwroot/xiaotest/calc.
htmlServer3.
IISservercreatesanIPpackettoofHTTPresponse.
130.
101.
10.
08130.
101.
10.
31HTTPHeaderHTMLtextincalc.
htmlIPpackethtmlhttpServerIISPort80HTTPIPPacketofHTTPResponse130.
101.
10.
08130.
101.
10.
31HTTPHeaderHTMLtextincalc.
htmlIPPackethtmlhttpwinserv1ServersendstheIPpacketofHTTPresponsebacktotheClientHDC:/inetpub/wwwroot/xiaotest/calc.
htmlClientClientMachineWebBrowserwinserv1.
cs.
uakron.
edu/xiaotest/calc.
htmlAddshttp://asdefault1.
2.
Addsportnum:803.
GetstheIPAddressfromDNS130.
101.
10.
314.
IPpacket5.
Opensport80on130.
101.
10.
316.
SendsthepacketashttprequestReceivestheHTTPresponseIPpacketfromtheServer7.
InterpretsHTMLanddisplays8.
+=op1op2Thebrowsersendsthenewpackettotheserveragain11.
Theuserenterstheinputandhitsthesubmitbutton.
Thebrowsercreatesanotherpacketwiththeinput.
9.
10.
IPPacket130.
101.
10.
31130.
101.
10.
08HTTPGET/xiaotest/calc.
html------[blankline]ServerASP.
NETIISwinserv1ServerASP.
NETIISwinserv1CLRVMIPport80HTTPC:/inetpub/wwwroot/HDServerASP.
NETIISwinserv1CLRVMIPport80HTTPC:/inetpub/wwwroot/HDvoidOnAdd(Objectsender,EventArgse)inta=Convert.
ToInt32(op1.
Text);intb=Convert.
ToInt32(op2.
Text);Sum.
Text=(a+b).
ToString();}Calc.
aspxHDServerASP.
NETIISCLRVMInternetPort.
aspxHTTP:80htmlwinserv1HTTPrequestfromClient1.
2.
IISretrievesxiaotest/calc.
aspxsendsittoASP.
NETC:/inetpub/wwwroot/C:/inetpub/wwwroot/xiaotest/calc.
htmlASP.
NETprocesses.
aspxwhichdynamicallygeneratesanhtmlThehtmlissentbacktoIIS3.
ClientClientMachineWebBrowserwinserv1.
cs.
uakron.
edu/xiaotest/calc.
htmlAddshttp://asdefault1.
2.
Addsportnum:803.
GetsIPAddressDNS130.
101.
10.
314.
IPpacketIPPacket130.
101.
10.
31HTTPipaddressGET/xiaotest/calc.
html------[blankline]5.
Opensport80on130.
101.
10.
316.
SendsthepacketofhttprequestReceivestheHTTPresponsepacketfromServer7.
InterpretsHTMLanddisplays8.
+Submitop1op212.
Theuserenterstheinputandhitssubmitbutton89.
11.
816Thebrowsercreatesanotherpacketwiththeinput.
ThebrowsersendsthepackettotheserveragainIIS->ASP.
NET->ButtoncreateClickevent->OnClick()invoked->Result->HTML->IIS->HTTP->Client->BrowserDisplays.
10.
SummaryWebProgramming,ClientSide,ServerSide,HTTP,HTML,HTMLForms,CGI,ISAPI,ASP,ASP.
NET,ASP.
NETForms,ASP.
NETControls,IIS,WebFormsProgrammingModel,Page-LevelEvents,CodeBehind.
Principles:WhataretheyHowdotheywork(internals,staticstructures,dynamicdata/eventflow.
)Practice:Explainthelogic,output,andinternalworkingofgivencode.
Finderrorsinagivencodesegment.
Writeasimpleprogramtoperformagiventask.

atcloud:480G超高防御VPS低至$4/月,美国/新加坡等6机房,512m内存/1核/500g硬盘/不限流量

atcloud主要提供常规cloud(VPS)和storage(大硬盘存储)系列VPS,其数据中心分布在美国(俄勒冈、弗吉尼亚)、加拿大、英国、法国、德国、新加坡,所有VPS默认提供480Gbps的超高DDoS防御+不限流量,杜绝DDoS攻击骚扰,比较适合海外建站等相关业务。ATCLOUD.NET是一家成立于2020年的海外主机商,主要提供KVM架构的VPS产品、LXC容器化产品、权威DNS智能解...

Vinahost - 越南VPS主机商月6美元 季付以上赠送时长最多半年

Vinahost,这个主机商还是第一次介绍到,翻看商家的介绍信息,是一家成立于2008年的老牌越南主机商,业务涵盖网站设计、域名、SSL证书、电子邮箱、虚拟主机、越南VPS、云计算、越南服务器出租以及设备托管等,机房主要在越南胡志明市的Viettle和VNPT数据中心,其中VNPT数据中心对于国内是三网直连,速度优。类似很多海外主机商一样,希望拓展自己的业务,必须要降价优惠或者增加机房迎合需求用户...

麻花云-香港CN2云服务器,安徽BGP线路,安徽移动大带宽!全系6折!

一、麻花云官网点击直达麻花云官方网站二、活动方案优惠码:专属优惠码:F1B07B 享受85折优惠。点击访问活动链接最新活动 :五一狂欢 惠战到底 香港云主机 1.9折起香港特价体验云主机CN2 云服务器最新上线KVM架构,,默认40G SSD,+10G自带一个IPv4,免费10Gbps防御,CPU内存带宽价格购买1核1G1M19元首月链接2核2G 2M92元/3个月链接2核4G3M112元/3个月...

aspweb服务器为你推荐
操作httphttp404未找到"HTTP 404 未找到"的错误如何对付?_苹果appstore宕机apple id登陆不了app store怎么办资费标准电信套餐资费介绍表滴滴估值500亿滴滴流水每天280元一个月下来能赚 多少银花珠树晓来看谜语白色花无人栽一夜北风遍地开。旡根无叶又无枝不知是谁送花来。谜底是什么刚刚网刚刚网上刷单被骗了5万多怎么办啊 报警有用吗刚刚网刚刚在网上认识了一个女孩子,不是很了解她,就跟她表白了。闪拍网闪拍网是真的吗可信网站可信网站 是自己去注册的还是由做网站 的人帮弄的?
宿迁服务器租用 pw域名 linode 好看的桌面背景图 微信收钱 vip购优汇 免费全能主机 什么是服务器托管 免费智能解析 怎么建立邮箱 网页提速 华为k3 空间申请 apnic rewritecond magento主机 卡巴斯基免费下载 paypal登陆 免费服务器 天鹰抗ddos防火墙 更多