home *** CD-ROM | disk | FTP | other *** search
/ Excalibur 71 / Excalibur_71_cd2.bin / Microsoft_Internet_50 / ieak5.exe / RCDATA / CABINET / autocfg.asp < prev    next >
Text File  |  1999-02-24  |  5KB  |  167 lines

  1. <%
  2.  
  3. ' ------------------------------------------------------
  4. '| FILE:    AUTOCFG.ASP                    |    
  5. '| DATE:    01/06/99                |
  6. '| AUTHOR:     Erik Mikkelson (Microsoft)        |
  7. '| DESCRIPTION: Customizable ASP script to perform the    |
  8. '|             IEAK AutoConfig              |
  9. '| Copyright Microsoft Corpation 1999            |
  10. ' ------------------------------------------------------
  11.  
  12.     ' ----------------------------------------------------
  13.     '| Set the DEBUGFLAG variable to              |
  14.     '| TRUE to DEBUG this file. By default this parameter |
  15.     '| is FALSE                          |
  16.     ' ----------------------------------------------------
  17.  
  18.     DEBUGFLAG = FALSE
  19.     
  20.     'DEBUG INFO
  21.     if DEBUGFLAG =TRUE then
  22.         Response.Write "<html><title>Debug Info</title><body><FONT COLOR=RED> <B>DEBUG OUTPUT:</B></FONT>"
  23.         Response.Write "<P>This debug output should aid you in solving any problems you might have in using this script.</P>"
  24.     end if
  25.     
  26.     
  27.     ' ---------------------------------------------------
  28.     '| Get the authenticated user's DOMAIN and USER NAME |                                    
  29.     ' ---------------------------------------------------
  30.     
  31.     AuthDomainandUser=Request.ServerVariables("LOGON_USER")
  32.     
  33.  
  34.     ' ----------------------------------------------------
  35.     '| Enter the default domain and user name that the    |
  36.     '| server should use if it doesn't recognize the user |
  37.     ' ----------------------------------------------------
  38.  
  39.     if AuthDomainandUser="" then AuthDomainandUser="DOMAIN\guest"
  40.  
  41.     'DEBUG INFO
  42.     if DEBUGFLAG =TRUE then
  43.         Response.Write "<P>The web server is detecting that the user is logged in with the following domain name and user name.</P>"
  44.         Response.Write "<P><CENTER><B>" & AuthDomainandUser & "</B></CENTER></P>"
  45.  
  46.         Response.Write "<P>If the guest account that you specified in this active server script always equals your guest account (eg. 'DOMAIN\GUEST') "
  47.         Response.Write "make sure that the authentication method for this ASP file is set to 'Allow Anonymous' and 'Windows NT Challenge/Response', and that Internet User Account (IUSR_computer name) has No Access to AUTOCFG.ASP.</P>"
  48.  
  49.         Response.Write "<P> The authentication method used by the server is <B>" & Request.ServerVariables("AUTH_TYPE") & "</B></P>"
  50.     end if
  51.  
  52.  
  53.     ' ------------------------------------------------
  54.     '| Flip the "\" to a "/" so that the ADSI Command |
  55.     '| GetObject:// can use it                        |
  56.     ' ------------------------------------------------
  57.  
  58.     AuthDomainandUser = Replace(AuthDomainandUser, "\", "/")
  59.  
  60.  
  61.     ' ----------------------------------------------------
  62.     '| Use the GetObject (ADSI) to obtain the user object |
  63.     ' ----------------------------------------------------
  64.  
  65.     Set User=GetObject("WinNT://" & AuthDomainandUser)
  66.     
  67.  
  68.     ' --------------------------------------------------------
  69.     '| Loop through all NT Global Groups of which the user is | 
  70.     '| a member looking for the "IE_" prefix to a group name  |
  71.     ' --------------------------------------------------------
  72.  
  73.     For Each Group in User.Groups
  74.  
  75.         if Left(Group.Name, 3) = "IE_" then
  76.             IsGroupMember = TRUE
  77.             IEGroupName = Group.Name
  78.         end if
  79.     Next
  80.  
  81.     'DEBUG INFO
  82.     if DEBUGFLAG = TRUE then
  83.         Response.Write "<P>These are all of the NT Global Groups that the user is a member of.  This script will look for the "
  84.         Response.Write "first group that starts with 'IE_' and use it for the INS filename.</P>"
  85.         Response.Write "<P><UL><B>" & AuthDomainandUser & "</b> is a member of the following groups<BR><UL>"
  86.         for each group in user.groups
  87.         Response.Write "<LI>" & Group.Name & "</LI>"
  88.         next
  89.         Response.Write "</ul></ul></P>"
  90.     end if
  91.  
  92.  
  93.     ' --------------------------------------------
  94.     '| If user is a Member of IE_[groupname] then |
  95.     '| the filename is [groupname].ins, else it's |
  96.     '| IE_Default.ins                             |
  97.     ' --------------------------------------------
  98.  
  99.     if IsGroupMember = TRUE then
  100.  
  101.         'DEBUG INFO    
  102.         if DEBUGFLAG = TRUE then
  103.             Response.Write "<P>The script found this group name <b>" & IEGroupName & "</b></p>"
  104.         end if
  105.  
  106.         TheINSFileName = IEGroupName & ".ins"        
  107.  
  108.  
  109.         ' ------------------------------
  110.         '| If DEBUGFLAG <> TRUE,        |
  111.         '| redirect to [groupname].ins, |
  112.         '| else display the filename    |
  113.         ' ------------------------------
  114.         
  115.         if DEBUGFLAG = TRUE then
  116.  
  117.             'DEBUG INFO
  118.             Response.Write "If you weren't debugging this file you would be redirected to <B>" & TheINSFileName & "</B>"
  119.         
  120.         else
  121.         
  122.             Response.Redirect "ins/" & TheINSFileName
  123.         
  124.         end if 
  125.  
  126.     
  127.     else 
  128.  
  129.  
  130.         ' -------------------------------
  131.         '| Retrieve the Default INS File |
  132.         ' ------------------------------- 
  133.  
  134.         'DEBUG INFO
  135.         if DEBUGFLAG = TRUE then
  136.             Response.Write "<P>The script did not find any group starting with 'IE_' of which <B>" & AuthDomainandUser & "</B> is a member.  "
  137.             Response.Write "It will use the default script ('IE_Default') instead.</p>"
  138.         end if
  139.  
  140.         TheINSFileName = "IE_Default.ins"
  141.         
  142.         
  143.         ' ------------------------------
  144.         '| If DEBUGFLAG <> TRUE,        |
  145.         '| redirect to [groupname].ins, |
  146.         '| else display the filename    |
  147.         ' ------------------------------    
  148.  
  149.         if DEBUGFLAG = TRUE then
  150.             
  151.             'DEBUG INFO
  152.             Response.Write "If you weren't debugging this File you would be redirected to <B>" & TheINSFileName & "</B>"
  153.             Response.Write "</body></html>"
  154.  
  155.         else
  156.  
  157.             Response.Redirect "ins/" & TheINSFileName
  158.  
  159.         end if 
  160.  
  161.     end if
  162.  
  163.  
  164. ' ------------
  165. '| End Script |
  166. ' ------------
  167. %>