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.

#消息# contabo:德国老牌机房新增美国“纽约、西雅图”数据中心,免设置费

运作了18年的德国老牌机房contabo在继去年4月开办了第一个美国数据中心(中部城市:圣路易斯)后立马在本月全新上马两个数据中心:纽约、西雅图。当前,为庆祝美国独立日,美国三个数据中心的VPS全部免除设置费,VPS本身的配置很高,价格适中,有较高的性价比!官方网站:https://contabo.com/en/SSD VPSKVM虚拟,纯SSD阵列,不限制流量,自带一个IPv4内存CPUSSD带...

ZJI全新上架香港站群服务器,4C段238个IP月付1400元起

ZJI本月新上线了香港葵湾机房站群服务器,提供4个C段238个IPv4,支持使用8折优惠码,优惠后最低每月1400元起。ZJI是原Wordpress圈知名主机商家:维翔主机,成立于2011年,2018年9月更名为ZJI,提供中国香港、台湾、日本、美国独立服务器(自营/数据中心直营)租用及VDS、虚拟主机空间、域名注册等业务,所选数据中心均为国内普遍访问速度不错的机房。葵湾二型(4C站群)CPU:I...

TMThosting:VPS月付55折起,独立服务器9折,西雅图机房,支持支付宝

TMThosting发布了今年黑色星期五的促销活动,即日起到12月6日,VPS主机最低55折起,独立服务器9折起,开设在西雅图机房。这是一家成立于2018年的国外主机商,主要提供VPS和独立服务器租用业务,数据中心包括美国西雅图和达拉斯,其中VPS基于KVM架构,都有提供免费的DDoS保护,支持选择Windows或者Linux操作系统。Budget HDD系列架构CPU内存硬盘流量系统价格单核51...

aspweb服务器为你推荐
thinkphpthinkphp与PHP的差别,怎么查看thinkphp编写的系统?mediawikimediawiki的乱码问题企业ssl证书ssl证书多少钱一年?新iphone也将禁售iPhone8plus在2020年还会有货吗搜狗360360浏览器为什么不能让我自动登录了资费标准电信套餐资费介绍表文档下载怎么下载百度文档开放平台众安开放平台是干什么的?上面的众推广是什么?网络u盘有没有网络U盘 5G的 就像真的U盘一样的?就像下载到真U盘一样的 到自己电脑直接复制就可以拉的啊zencart模板zen cart套用模板后,外观控制显示红色打不开,为什么?
域名解析服务器 草根过期域名 uk2 56折 ixwebhosting 双11抢红包攻略 windows2003iso 网盘申请 我爱水煮鱼 老左正传 国外代理服务器地址 vip购优惠 美国在线代理服务器 100mbps 支持外链的相册 如何建立邮箱 国外的代理服务器 杭州电信宽带优惠 主机返佣 空间服务器 更多