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.

raksmart:香港机房服务器实测评数据分享,告诉你raksmart服务器怎么样

raksmart作为一家老牌美国机房总是被很多人问到raksmart香港服务器怎么样、raksmart好不好?其实,这也好理解。香港服务器离大陆最近、理论上是不需要备案的服务器里面速度最快的,被过多关注也就在情理之中了。本着为大家趟雷就是本站的光荣这一理念,拿了一台raksmart的香港独立服务器,简单做个测评,分享下实测的数据,仅供参考!官方网站:https://www.raksmart.com...

ZJI-全场八折优惠,香港服务器 600元起,还有日本/美国/韩国服务器

ZJI怎么样?ZJI是一家成立于2011年的商家,原名维翔主机,主要从事独立服务器产品销售,目前主打中国香港、日本、美国独立服务器产品,是一个稳定、靠谱的老牌商家。详情如下:月付/年付优惠码:zji??下物理服务器/VDS/虚拟主机空间订单八折终身优惠(长期有效)一、ZJI官网点击直达香港葵湾特惠B型 CPU:E5-2650L核心:6核12线程内存:16GB硬盘:480GB SSD带宽:5Mbps...

国内云服务器 1核 2G 2M 15元/月 萤光云

标题【萤光云双十二 全场6折 15元/月 续费同价】今天站长给大家推荐一家国内云厂商的双十二活动。萤光云总部位于福建福州,其成立于2002 年。主打高防云服务器产品,主要提供福州、北京、上海 BGP 和香港 CN2 节点。萤光云的高防云服务器自带 50G 防御,适合高防建站、游戏高防等业务。这家厂商本次双十二算是性价比很高了。全线产品6折,上海 BGP 云服务器折扣更大 5.5 折(测试了一下是金...

aspweb服务器为你推荐
uctools新浪UC下载地址360公司迁至天津请问360公司的全称是什么?支付宝账户是什么好评返现 要支付宝帐号 支付宝帐号是什么啊asp.net网页制作怎么用ASP.NET 做一个网页注册。简单的就行重庆网站制作重庆网站制作哪家好,重庆做网站制作的公司有谁比较了解的,应该去哪里做好些?重庆网站制作重庆网站制作,哪家公司服务,价格都比较好?北京大学cuteftp加多宝与王老吉王老吉和加多宝什么关系?tumblr上不去百度为什么经常打不开中国保健养猪网135保健养猪,135天可以出栏吗?
新通用顶级域名 鲨鱼机 国内永久免费云服务器 2014年感恩节 nerd godaddy域名转出 2017年万圣节 申请空间 云鼎网络 html空间 老左正传 美国免费空间 idc查询 cloudlink atom处理器 广东主机托管 789电视剧网 国外免费网盘 开心online ftp是什么东西 更多