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.
新网好不好?新网域名便宜吗?新网怎么样?新网是国内老牌知名域名注册商,企业正规化运营,资质齐全,与阿里云万网和腾讯云DNSPOD同为国内服务商巨头。近日新网发布了最新的七月放价季优惠活动,主要针对域名、云主机、企业邮箱、SSL证书等多款云产品推送了超值的优惠,其中.com顶级域名仅19.9元/首年,.cn域名仅16元/首年,云主机1核心2G内存3Mbps带宽仅9.9元/月,企业邮箱更是免费送1年,...
官方网站:点击访问星梦云活动官网活动方案:机房CPU内存硬盘带宽IP防护流量原价活动价开通方式成都电信优化线路4vCPU4G40G+50G10Mbps1个100G不限流量210元/月 99元/月点击自助购买成都电信优化线路8vCPU8G40G+100G15Mbps1个100G不限流量370元/月 160元/月点击自助购买成都电信优化线路16vCPU16G40G+100G20Mb...
介绍:御速云成立于2021年的国人商家,深圳市御速信息技术有限公司旗下品牌,为您提供安全可靠的弹性计算服务,随着业务需求的变化,您可以实时扩展或缩减计算资源,使用弹性云计算可以极大降低您的软硬件采购成本,简化IT运维工作。主要从事VPS、虚拟主机、CDN等云计算产品业务,适合建站、新手上车的值得选择,拥有华东江苏、华东山东等国内优质云产品;香港三网直连(电信CN2GIA联通移动CN2直连);美国高...
aspweb服务器为你推荐
点击google检索网易yeahasp.net网页制作如何用DREAMWEAVER ASP.NET 做网页ipad代理想买个ipad买几代性价比比较高三友网广州三友集团在韶关分公司么?正大天地网二三线城市适合做生鲜b2b电商吗免费代理加盟怎么开免费的代理网店申请400电话400电话如何办理?站点管理dreamweaver 合作制作网站站点如何管理powerbydedecms如何去掉织梦网站底部的powered by dedecms方法
域名抢注 抗投诉vps主机 东莞电信局 免费申请网页 阿里云邮箱登陆首页 fastdomain oneasiahost 优key 香港机房托管 全能主机 本网站在美国维护 qq数据库下载 52测评网 e蜗 linux使用教程 怎么建立邮箱 新睿云 华为云盘 四川电信商城 移动服务器托管 更多