, ebook O'Reilly ASP Nutshell (1) 

[ Pobierz całość w formacie PDF ]
.All rights reserved. HTMLEncodeObjects with application-level scope are not destroyed until the Application_OnEnd event is fired.Session-scoped objects are similarly destroyed at the end ofa user s session or when the Abandon method of the Session object is called; seeChapter 9 for more details.Once an object is instantiated, it can be destroyed by setting its value to thekeyword Nothing, as in the following example code:Set objMyAdRot = NothingYou also can simply replace the value of the object variable to release the memorybeing used for the original object:Set objMyAdRot = strSomeOtherValueYou cannot use CreateObject to create an instance of one of the built-in objects.For example the following code will generate a runtime error:Set objMySession = Server.CreateObject("Session") ' WRONGHTMLEncodeServer.HTMLEncode (strHTMLString)If you ever need to display the actual HTML code involved in an HTML page orASP script, you must use the HTMLEncode method of the Server object.TheHTMLEncode method of the Server object allows you to encode the HTML stringso that, when it is displayed in the browser, the browser does not simply interpretthe HTML as instructions for text layout.ParametersstrHTMLStringThe string whose HTML code you wish to encode for display on the clientmachineExample118 Chapter 8  Server ObjectASP in a Nutshell: A Desktop Quick Reference, eMatter EditionCopyright © 2000 O Reilly & Associates, Inc.All rights reserved. MapPathNotesThe HTMLEncode method is a straightforward method that is simple to use.Itmakes it possible to display the source code of your HTML page or to demon-strate the use of various HTML tags in a web page.It is also invaluable fordisplaying the output of database queries.MapPathServer.MapPath (strPath)The MapPath method allows you to determine the physical path on the server,given a virtual or relative path.ParametersstrPathA complete virtual path or a path relative to the path of the current script shome directory on the server.The method determines how to interpret thestring depending on if it starts with either a slash (/) or a backslash (\).If thestrPath parameter begins with either of these characters, the string isassumed to be a complete virtual path.Otherwise, the physical path returnedis the path relative the current script s physical directory on the web server.ExampleURLEncode Example120 Chapter 8  Server ObjectASP in a Nutshell: A Desktop Quick Reference, eMatter EditionCopyright © 2000 O Reilly & Associates, Inc.All rights reserved. URLEncodeNotesThe URLEncode method, like the HTMLEncode method, is straightforward andeasy to use.It is imperative that you use the URLEncode method any time you areforced to send information over the address line instead of posting informationusing the POST method.If you do not encode your information and place it intothe QueryString collection (through the GET method), its interpretation is unpre-dictable, depending on the data sent.If you send information in the query string (i.e., from visible frame to visibleframe), but not over the address line, this encoding is done for you.URLEncode 121ASP in a Nutshell: A Desktop Quick Reference, eMatter EditionCopyright © 2000 O Reilly & Associates, Inc.All rights reserved. Chapter 9Session ObjectCHAPTER 9Session ObjectOne of the greatest challenges you face in constructing a full-featured web appli-cation is keeping track of user-specific information while a user navigates your sitewithout asking her to identify herself at every request from the server.Amongother pieces of information that you need to maintain are a user s identification, auser s security clearance if applicable, and, in more advanced applications, userpreferences that allow you to customize your web site s look and feel in responseto selections made by the user.The primary problem with maintaining user-specific information is limitations in the currently standard HTTP 1.0 protocol.Although HTTP 1 [ Pobierz caÅ‚ość w formacie PDF ]
  • zanotowane.pl
  • doc.pisz.pl
  • pdf.pisz.pl
  • anikol.xlx.pl