1 / 89

Chapter Objectives

Chapter Objectives. Web Applications (Page 464). Web application Group of files and folders (including virtual folders) located in Web applications root directory Virtual Web and directories Stored outside of the C:Inetpubwwwroot folder Internet Information Services Management Tools

bree
Download Presentation

Chapter Objectives

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Chapter Objectives Introduction to ASP.NET, Second Edition

  2. Web Applications (Page 464) • Web application • Group of files and folders (including virtual folders) located in Web applications root directory • Virtual Web and directories • Stored outside of the C:\Inetpub\wwwroot\ folder • Internet Information Services Management Tools • Create Chapter9 project and import files • Microsoft Management Console (MMC) • %systemroot%\System32\inetserv\iis.mmc Introduction to ASP.NET, Second Edition

  3. The Internet Information Services Management Tools Introduction to ASP.NET, Second Edition

  4. The Internet Information Services Management Tools (continued) Introduction to ASP.NET, Second Edition

  5. Web Application Memory Models Introduction to ASP.NET, Second Edition

  6. Web Application Memory Models (continued) • Create Chapter9High process • Configure to run in isolated process • IIS MMC – Directory tab, change Application Protection property to High(Isolated) • Use Component Services • %systemroot%\system32\Com\comexp.msc Introduction to ASP.NET, Second Edition

  7. Web Application Memory Models(continued, Page 468) Introduction to ASP.NET, Second Edition

  8. Web Application Memory Models (continued) Introduction to ASP.NET, Second Edition

  9. Session Data • User information tracked across user sessions • HTTP headers - ServerVariables collection • SessionID - identifies each session • Read Session ID, ServerVariables, store data Dim SID As String = Session.SessionID Session("UserAgent") = Request.UserAgent.ToString Session("SID") = SID Dim strName As String = txtName.Text Session("username") = strName Introduction to ASP.NET, Second Edition

  10. SessionGetVariables.aspx (Page 471) Introduction to ASP.NET, Second Edition

  11. Session Data (continued) Introduction to ASP.NET, Second Edition

  12. Building Information Management Security Policies • Security Policies • Sample – encode forms to prevent entering <> Dim strName As String strName = txtName.ToString message.Text = "Welcome " &  HTTPUtility.Encode(strName) • Privacy Policies • Inform user about information being collected and what is being done with that information Introduction to ASP.NET, Second Edition

  13. Application Configuration • Registry - Windows applications store configuration settings • Metabase stored Web application configuration • To access the Metabase • Microsoft Management Console (MMC) – local application • Windows Scripting Host (WSH) - creates scripts to access the Metabase • ASP.NET configuration files Introduction to ASP.NET, Second Edition

  14. Viewing the Web Server Property Pages(Page 477) • Web Site Tab • IP address and Port • HTTP Keep-Alives Enabled - maintain state • W3C Extended Log File Format • Extended properties • Default location - %WinDir%\System32\LogFiles • Default directory - is W3SVC1 • Log filename - is named after the date • Local time Introduction to ASP.NET, Second Edition

  15. Viewing the Web Server Property Pages (continued) Introduction to ASP.NET, Second Edition

  16. Viewing the Web Server Property Pages (continued) Introduction to ASP.NET, Second Edition

  17. Viewing the Web Server Property Pages (continued) Introduction to ASP.NET, Second Edition

  18. Viewing the Web Server Property Pages (continued) • Documents tab • Default document name • Document Footer • HTTP Headers tab • Expire page content • Internet Content Rating Association (ICRA) • Home Directory tab • Web site location • Properties – Read, Write, Directory browsing, Log visits property, Index this resource, Script source, Execute, Scripts only • Configuration Introduction to ASP.NET, Second Edition

  19. Viewing the Web Server Property Pages (continued) Introduction to ASP.NET, Second Edition

  20. Viewing the Web Server Property Pages (continued) Introduction to ASP.NET, Second Edition

  21. Application Configuration Files • XML-based • Machine-level - machine.config • Application - Web.config • settings configured as a node, include nested child nodes • Root node - <configuration> • ConfigSections node - identify configuration sections • system.web - Web configuration settings Introduction to ASP.NET, Second Edition

  22. The AppSettings Configuration Node • Key/value pairs - application variables <appSettings> <add key="SN" value="Tara Store" /> </appSettings> • Retrieve dim SN as string SN =  ConfigurationSetttings.AppSettings("SN") Introduction to ASP.NET, Second Edition

  23. The Pages Configuration Node • How content is delivered to the Web page • Buffer - area in memory on the server • enableSessionState - use Session • enableViewState - store data in ViewState • enableViewStateMac - validate data in ViewState • autoEventWireup - override Page_OnLoad event • SmartNavigation - continue at the row where they left off when they refresh the page Introduction to ASP.NET, Second Edition

  24. The httpRuntime Configuration Node • Properties: • executionTimeout - time allowed to execute before the request times out • maxRequestLength - kilobytes accepted from an HTTP request • UseFullyQualifiedRedirectURL - fully qualify the URL when the client has been redirected to a new page Introduction to ASP.NET, Second Edition

  25. Globalization Configuration Node • Encoding standard • Unicode - each character set has its own identity • Default value is UTF-8 • All Unicode character values are supported • Culture and uiCulture • Can set at page level, to configure language & dates • Identify a language and culture string • fr-FR for French • en-US for United States English Introduction to ASP.NET, Second Edition

  26. Setting the Culture Property France.aspx (Page 489) Introduction to ASP.NET, Second Edition

  27. Compilation Node Configuration • Language compilers build applications • DefaultLanguage property • Can set at page level <%@ Page Language="vb" %> • Explicit - declare your variables • Strict - declare the variable data type <compilation debug="false" explicit="true" defaultLanguage="vb" > </compilation> Introduction to ASP.NET, Second Edition

  28. Trace Node Configuration • Properties • enabled - turn tracing on • localOnly - results displayed at http://localhost/. • traceMode - sort trace results • pageOutput - display results with Web page • trace stack – stores data • requestLimit - number of trace results stored Introduction to ASP.NET, Second Edition

  29. Trace Node Configuration (continued) • Trace.Write • Trace.Write – writes data to trace stack • Trace.Warn shows up in red font • Trace.Write("CategoryName", "Value") • TraceTool • http://localhost/approot/Trace.axd • http://localhost/Configuration/Tracing/TraceTool/trace.axd Introduction to ASP.NET, Second Edition

  30. Trace Node Configuration (continued) Introduction to ASP.NET, Second Edition

  31. Using the Trace Utility Program Trace.aspx (Page 493) • Change Web.config <trace enabled="true" requestLimit="10" pageOutput="false" traceMode="SortByTime" localOnly="true" /> Introduction to ASP.NET, Second Edition

  32. Trace.aspx (continued) Introduction to ASP.NET, Second Edition

  33. Trace.aspx (continued) Introduction to ASP.NET, Second Edition

  34. Trace.aspx (continued) Introduction to ASP.NET, Second Edition

  35. CustomErrors Node Configuration • Both ASP.NET and IIS provide error pages • IIS Web pages - c:\winnt\Help\iisHelp\common\ directory • MMC - configure custom error pages • HTTP status message code - status of request • 200 - success • 404 - file requested could not be found • 400’s usually indicate a client-related error • 500’s usually indicate a server-related error Introduction to ASP.NET, Second Edition

  36. CustomErrors Node Configuration (continued) • Properties: • Mode – where to display rich error pages (yellow) • RemoteOnly - only locally • On - custom error pages except at localhost • Off - ASP.NET error pages displayed • defaultRedirect property - sets a default error page if no custom error page is configured • errornode – uses statusCode to redirect user Introduction to ASP.NET, Second Edition

  37. CustomErrors Node Configuration (continued) <customErrors mode="RemoteOnly" defaultRedirect="/defaultError.aspx"/> <error statusCode="404" redirect="/error404.aspx"/> </customErrors> Introduction to ASP.NET, Second Edition

  38. CustomErrors Node Configuration (continued) Introduction to ASP.NET, Second Edition

  39. Maintaining State in an ASP.NET Application • Methods - unique identifier to recognize the client across Web pages: • ViewState – with hidden fields • Client-Side Cookies - • ASP.NET uses Application and Session objects • Cookieless applications – identification data is passed with the URL. Introduction to ASP.NET, Second Edition

  40. Client-Side Cookies • Small piece of information stored on client • Cookies collection - group of cookies • Sent by the server through the header • Browser writes the cookie <script language="JavaScript"> document.cookie = "CookieEmail=kkalatatarastore.com; expires =Monday, 07-Jan-07 12:00:00 GMT"; readCookie = document.cookie; </script> Introduction to ASP.NET, Second Edition

  41. Client-Side Cookies (continued) Introduction to ASP.NET, Second Edition

  42. Client-Side Cookies ClientCookies.aspx (Page 499) Introduction to ASP.NET, Second Edition

  43. Cookie Settings in the Internet Explorer Browser Introduction to ASP.NET, Second Edition

  44. Cookie Settings in the Internet Explorer Browser (continued) Introduction to ASP.NET, Second Edition

  45. Cookie Settings in the Internet Explorer Browser (continued) Introduction to ASP.NET, Second Edition

  46. Creating Cookies with ASP.NET • HTTP cookies - created by the Web server • SessionID - value of the HTTP cookie • Retrieve using server variable HTTP_COOKIE <% Request.ServerVariables("HTTP_COOKIE") %> • Response.Cookies • Sends cookie to browser in Set-Cookie header • Named group of cookies - dictionary cookie • Individual cookies - cookie keys Introduction to ASP.NET, Second Edition

  47. Creating Cookies with ASP.NET (continued) • Create cookie <% Response.Cookies("myCookie") = "value" %> <% Response.Cookies("myCookie").Expires =  "MM DD, YYYY" %> • Read cookie <% Request.Cookies("myCookie")%> Introduction to ASP.NET, Second Edition

  48. Maintaining State with Cookies Cookies.aspx (Page 505) Introduction to ASP.NET, Second Edition

  49. Cookies.aspx (continued) Introduction to ASP.NET, Second Edition

More Related