home *** CD-ROM | disk | FTP | other *** search
/ Chip 1998 February / CHIP_2_98.iso / software / pelne / optionp / iis4_07.cab / HIWProfile.asp < prev    next >
Text File  |  1997-11-01  |  10KB  |  181 lines

  1. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
  2. <HTML>
  3. <HEAD>
  4. <!--META TAGS ARE RECOMMENDED FOR THE SEARCH ENGINE-->
  5. <META NAME="DESCRIPTION" CONTENT="How It Works Page">
  6. <META NAME="KEYWORDS" CONTENT="help, code, source code, questions, explanation">
  7. <META NAME="GENERATOR" CONTENT="Microsoft Visual InterDev 1.0">
  8. <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso8859-1">
  9. <!--END META TAGS-->
  10.  
  11. <TITLE>How The Profile Page Works</TITLE>
  12. </HEAD>
  13.  
  14. <BODY  BGCOLOR=#FFFFFF TOPMARGIN=0 LEFTMARGIN=0 ALINK=#23238E VLINK=#808080 LINK=#FFCC00>
  15. <BASEFONT FACE="VERDANA, ARIAL, HELVETICA" SIZE=2>
  16.  
  17. <!--Change link color on mouseover
  18.     Only if running Internet Explorer 4.0 or later -->
  19. <!--#include file=../libHighlight.inc-->
  20.  
  21. <!--BEGIN TOP TABLE HOLDING GRAPHIC, NAVIGATIONAL LINK, AND INTRODUCTORY CONTENT-->
  22. <TABLE WIDTH="100%" HEIGHT="100%" CELLPADDING=0 CELLSPACING=0  BGCOLOR="#000000" BORDER=0>
  23.     <TR>
  24.         <TD BGCOLOR="#000000" ALIGN=CENTER VALIGN=TOP WIDTH=170>
  25.             <BR>
  26.             <IMG SRC="../images/btslarge.jpg" HEIGHT=119 WIDTH=171  ALT="Behind the Scenes at Exploration Air" BORDER=0 ></A>
  27.             <BR>
  28.             <BR>
  29.             <BR>
  30.             <!--BACK BUTTON AND VARIABLE TO RETURN TO ORIGINATING PAGE-->
  31.             <A HREF="<%=Request.ServerVariables("HTTP_REFERER")%>"><IMG SRC="../images/barrowy.gif" HEIGHT=8 WIDTH=8 ALT="Return to Previous Page"  HSPACE=2  BORDER=0></A>
  32.             <FONT SIZE=2 FACE="VERDANA, ARIAL, HELVETICA"><STRONG>
  33.             <A HREF="<%=Request.ServerVariables("HTTP_REFERER")%>">
  34.             B  A  C  K
  35.             </A></STRONG></FONT>
  36.             <BR> 
  37.             <BR>
  38.             <!--JAVASCRIPT TO VIEW PAGE'S SOURCE CODE-->
  39.             <FONT SIZE=2 FACE="VERDANA, ARIAL, HELVETICA">
  40.             <A HREF="JavaScript:openWindow('../freqflyer/Profile.asp')">V I E W   S O U R C E</A>
  41.             <BR></FONT>
  42.         </TD>
  43.  
  44.         <TD BGCOLOR="#FFFFFF" BACKGROUND="../images/btsbg.gif" VALIGN=top>
  45.             <BR CLEAR=ALL>
  46.             <TABLE WIDTH="100%" CELLPADDING=10 CELLSPACING=0 BORDER=0>   
  47.                 <TR>
  48.                     <TD VALIGN=top>
  49.                         <FONT FACE="VERDANA, ARIAL, HELVETICA" COLOR="#0000FF" SIZE=5>How The Profile Page Works</FONT>
  50.                         <HR>
  51.  
  52.                         <H2>Functional Overview</H2>
  53.                         The user, having logged into the Frequent Flyer application, goes to the Member Profile page: Profile.asp.
  54.                         This page consists of a large form full of user information retrieved from the database when the page loads. 
  55.                         The user makes changes to the page by editing the form and clicks on the submit button when finished. 
  56.                         The form is validated using JavaScript. If the validation is successful, then the form is posted to the same 
  57.                         page: Profile.asp.  Since a form value was passed to the page to indicate that this is a submission request, 
  58.                         the page does not display any of its HTML, but rather takes the form values and sends them to the components 
  59.                         that handles updating the database. If no errors are returned, then Profile.asp redirects to Default.asp.
  60.  
  61.                         <H2>Data Model</H2>
  62.                         Four tables from the Frequent Flyer database are involved: the diagram below is only a subset of the entire data model<p> 
  63.                         <CENTER><IMG BORDER=0 SRC="images/ProfileDB.jpg" WIDTH=325 HEIGHT=189 ALT="Data Model">
  64.                         <BR>
  65.                         <STRONG>Data Model of tables used to update profiles</STRONG>
  66.                         </CENTER>
  67.                         <!--END TOP TABLE HOLDING GRAPHIC, NAVIGATIONAL LINK, AND INTRODUCTORY CONTENT-->
  68.  
  69.                         <BR>
  70.                         <!--BEGIN TABLES HOLDING MAIN CONTENT-->
  71.                         <CENTER>
  72.                         <TABLE ALIGN=CENTER BORDER=1 WIDTH=90%>
  73.                             <TR><TH BGCOLOR="#C0C0C0">Table</TH><TH BGCOLOR="#C0C0C0">Comment</TH>
  74.                             <TR><TD><STRONG>Member</STRONG></TD><TD>Includes information about the user including contact information and preferences such as seating, smoking, and eating. One record from this table is involved in the scenario. When a new member joins, a SQL Server default value on the Mileage column gives the new member 50,000 miles.</TD></TR>
  75.                             <TR><TD><STRONG>Interests</STRONG></TD><TD>A list of interests such as Fishing, Golfing, Tropical Vacations. All of the records from this table are retrieved in order to create the check boxes for each of these interests.</TD></TR>
  76.                             <TR><TD><STRONG>MembersInterests</STRONG></TD><TD>Consists of records which list an InterestID and a MemberID. When querying the database all the records which match the current AccountID are retrieved. When updating the database, all of these records are deleted and as many new records are written as the user has indicated as interests on the form.</TD></TR>
  77.                             <TR><TD><STRONG>InterestCategories</STRONG></TD><TD>Is queried along with Interests to provide a category name that will appear with the interests.
  78.                         </TABLE>
  79.                         </CENTER>
  80.  
  81.                         <H2>Components Used</H2>
  82.                         The <STRONG>ExAir</STRONG> component is written in Microsoft Visual Basic 5 and is called from profile.asp. 
  83.                         It includes a class called <B>Member</B> which handles all changes to the Members and MembersInterests tables of the database.
  84.                         <P>
  85.                         The methods involved in the process described above are:
  86.                         <P>
  87.                         <CENTER>
  88.                         <TABLE ALIGN=CENTER BORDER=1 WIDTH=90%>
  89.                             <TR><TH BGCOLOR="#C0C0C0">Table</TH><TH BGCOLOR="#C0C0C0">Comment</TH>
  90.                             <TR><TD>Member.GetForID</TD><TD>Retrieves account information about the user by querying the Member database with the AccountID (which was stored in a session variable when the user logged on).</TD></TR>
  91.                             <TR><TD>Member.ListInterests</TD><TD>Retrieves all of the interests, along with the category name of the interests, and indicates whether this particular user has indicated each interest. All of this is achieved in one operation with a SQL SELECT statement that performs a LEFT JOIN along with a nested INNER JOIN.</TD></TR>
  92.                             <TR><TD>Member.Update</TD><TD>Writes all of the changes to the Member table.</TD></TR>
  93.                             <TR><TD>Member.UpdateInterests</TD><TD>Writes all of the changes to the MembersInterests table.</TD></TR>
  94.                         </TABLE>
  95.                         </CENTER>
  96.  
  97.                         <H2>Transaction Usage</H2>
  98.                         The Member class is registered with Microsoft Transaction Server (MTS). The four methods listed above 
  99.                         all contain code that manages the transaction so that if connections to the database fail, or other
  100.                         errors occur while the components are running, the transaction can be safely aborted. This code also
  101.                         insures that as soon as the components are done performing their allotted tasks, they can be reused
  102.                         by other clients, thus providing maximum scalability.
  103.                         <P>
  104.  
  105.                         <H3>Process Isolation</H3>
  106.                         The member component is registered with Microsoft Transaction Server. It is located in the Exploration Air package. 
  107.                         The package runs in a separate process from IIS, giving process isolation. 
  108.                         Separating the business components into another process will help protect the IIS process from corruption or failure 
  109.                         due to bad behavior of the business components.  This protection should minimize the chances of the Web server being interrupted.
  110.  
  111.                         <H3>Transactions</H3>
  112.                         The member component's transactional property is set to <B>Required</B>. 
  113.                         By setting the transactional property of the component MTS will guarantee that the information that is either 
  114.                         read or updated will always be protected from corruption.  The following protection is guaranteed.
  115.  
  116.                         <DIR>
  117.                             <LI><B>Atomic</B> - Member profile and interests are updated as one atomic piece of work.
  118.                             <LI><B>Consistent</B> - Interests will always match the current member profile.
  119.                             <LI><B>Isolated</B> - When updates are being made others are locked out of that data.
  120.                             <LI><B>Durable</B> - Updates are committed and made durable in SQL Server.
  121.                         </DIR>
  122.  
  123.                         In the case of a failure, whether programmatic or system, MTS will automatically abort the current transaction.
  124.  
  125.                         <H3>Resource Management</H3>
  126.                         Many resources that are used in an application can be shared among all of the components in the application.  
  127.                         Resources such as database connections are automatically being pooled.  This allows for very quick access to data 
  128.                         as the connection does not need to be "rebuilt" each time it is requested but rather can be shared among many users 
  129.                         accessing the same data.  Other resources, such as threads, are also shared.
  130.  
  131.                         <H3>State Management</H3>
  132.                         The above services, such as database connections and threads, are 
  133.                         provided automatically by registering the components with MTS.  In 
  134.                         order for MTS to optimize state management on the server the 
  135.                         component "tells" MTS at the end of a method call that it has 
  136.                         completed its work and no longer needs the state to be held.  MTS is 
  137.                         then able to release the state of the object as soon as the method is 
  138.                         complete.  Although clients may maintain references to objects the 
  139.                         actual activations of components will exist only when methods are 
  140.                         executing on the object.  This behavior allows many more users 
  141.                         to access the same server.
  142.                     </TD>
  143.                 </TR>
  144.             </TABLE>
  145.             <!--END TABLES HOLDING GRAPHIC, NAVIGATIONAL LINK, AND MAIN CONTENT-->
  146.  
  147.             <BR>
  148.             <BR>
  149.  
  150.             <CENTER>
  151.             <!--BEGIN LEGAL INFORMATION-->
  152.             <TABLE CELLSPACING=0 CELLPADDING=0 BORDER=0>
  153.                 <TR>
  154.                     <TD>
  155.                         <FONT FACE="VERDANA, ARIAL, HELVETICA" SIZE="1"><A HREF="../legal.htm">©1997 Microsoft Corporation. All rights reserved. Terms of Use.</A></FONT>
  156.                         <P>
  157.                     </TD>
  158.                 </TR>
  159.             </TABLE>
  160.             </CENTER>
  161.             <!--END LEGAL INFORMATION-->
  162.         </TD>
  163.     </TR>
  164. </TABLE>
  165.  
  166. </BODY>
  167. </HTML>
  168. <!--END HTML-->
  169.  
  170. <SCRIPT LANGUAGE="JavaScript">
  171. function openWindow(SourceURL)
  172. {
  173.     // Set some defaults
  174.     width=450;
  175.     height=450;
  176.  
  177.     url = "code.asp?Source=" + SourceURL;
  178.     window.open(url,"Sample","resizable=yes,scrollbars=yes,width=" + width + ",height=" + height);
  179. }
  180. </SCRIPT>
  181.