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.

HostYun 新上美国CN2 GIA VPS 月15元

HostYun 商家以前是玩具主机商,这两年好像发展还挺迅速的,有点在要做点事情的味道。在前面也有多次介绍到HostYun商家新增的多款机房方案,价格相对还是比较便宜的。到目前为止,我们可以看到商家提供的VPS主机包括KVM和XEN架构,数据中心可选日本、韩国、香港和美国的多个地区机房,电信双程CN2 GIA线路,香港和日本机房,均为国内直连线路。近期,HostYun上线低价版美国CN2 GIA ...

湖北50G防御物理服务器( 199元/月 ),国内便宜的高防服务器

4324云是成立于2012年的老牌商家,主要经营国内服务器资源,是目前国内实力很强的商家,从价格上就可以看出来商家实力,这次商家给大家带来了全网最便宜的物理服务器。只能说用叹为观止形容。官网地址 点击进入由于是活动套餐 本款产品需要联系QQ客服 购买 QQ 800083597 QQ 2772347271CPU内存硬盘带宽IP防御价格e5 2630 12核16GBSSD 500GB​30M​1个IP...

TTcloud(月$70)E3-1270V3 8GB内存 10Mbps带宽 ,日本独立服务器

关于TTCLOUD服务商在今年初的时候有介绍过一次,而且对于他们家的美国圣何塞服务器有过简单的测评,这个服务商主要是提供独立服务器业务的。目前托管硬件已经达到5000台服务器或节点,主要经营圣何塞,洛杉矶以及日本东京三个地区的数据中心业务。这次看到商家有推出了新上架的日本独立服务器促销活动,价格 $70/月起,季付送10Mbps带宽。也可以跟进客户的需求进行各种DIY定制。内存CPU硬盘流量带宽价...

aspweb服务器为你推荐
企业cms企业站cms哪个好centos6.5linux centos 6.5 怎么安装软件中国企业信息网哪个查询企业信息的网站收录的企业信息最多outlookexpress系统自带的outlook express有什么用?怎么用?支付宝账户是什么什么是企业支付宝账户360免费建站怎样给360免费自助建站制作的企业网站做一级域名解析绑定?颁发的拼音大致的致的拼音申请400电话400电话如何办理?powerbydedecms如何去掉织梦网站底部的powered by dedecms方法zencart模板要把zen cart用好的话,需要具备哪些知识?
bandwagonhost 512av 回程路由 java虚拟主机 智能骨干网 qq对话框 电信虚拟主机 银盘服务是什么 in域名 安徽双线服务器 免费mysql数据库 美国迈阿密 godaddy空间 深圳主机托管 广州服务器托管 tracker服务器 中美互联网论坛 美国十大啦 瓦工工具 更多