<% '------------------------------------------------------------------------- ' share_httpprop.asp: Serves in modifying HTTP share properties. ' ' Copyright (c) Microsoft Corporation. All rights reserved. ' ' Date Description ' 12 March 2001 Creation Date. '------------------------------------------------------------------------- '------------------------------------------------------------------------- 'Form Variables '------------------------------------------------------------------------- Dim F_strReadCheckStatus_HttpProp ' to set the Read CheckBox status Dim F_strWriteCheckStatus_HttpProp ' to set the Write CheckBox status Dim F_intAccessReadWrite_HttpProp ' to store the access value(0,1,2 or 3) Const CONST_READ_PERMISSION=1 'constants used for querying WMI for Http share Const CONST_IIS = "IIS://" Const CONST_ROOT = "/Root/" F_intAccessReadWrite_HttpProp=CONST_READ_PERMISSION ' allow read permission '------------------------------------------------------------------------- 'Global Variables '------------------------------------------------------------------------- ' the required constants are already declared in the Share_FtpProp.asp %> <% '------------------------------------------------------------------------- ' Function name: ServeHTTPPage ' Description: Serves in displaying the page content ' Input Variables: None ' Output Variables: None ' Returns: None ' Global Variables: ' In: L_* - Localization content(form label text) ' In: F_strReadCheckStatus_HttpProp - status of Read CheckBox ' In: F_strWriteCheckStatus_HttpProp - status of Write CheckBox '------------------------------------------------------------------------- Function ServeHTTPPage Err.Clear On Error Resume Next %>
<%=L_ALLOW_PERMISSIONS_LABEL_TEXT%>
> <%=L_READ_LABEL_TEXT%>
> <%=L_WRITE_LABEL_TEXT%>
<% Call ServeHTTPHiddenValues End Function '------------------------------------------------------------------------- ' Function name: HTTPOnPostBackPage ' Description: Serves in getting the values from the form. ' Input Variables: None ' Output Variables: None ' Returns: None ' Global Variables: ' Out: F_intAccessReadWrite_HttpProp - the access permissions ' (0,1,2 or 3 only) ' Out: F_strReadCheckStatus_HttpProp - status of READ checkBox ' Out: F_strWriteCheckStatus_HttpProp - status of WRITE checkBox ' ' Status of checkBoxes = "CHECKED" or "" '------------------------------------------------------------------------- Function HTTPOnPostBackPage Err.Clear On Error Resume Next ' get the value of the hidden variable from the form F_intAccessReadWrite_HttpProp = Request.Form("hdnintAccessReadWriteHttpProp") ' If the share is not HTTP and the checkBox is checked now, ' give the default values for the new http share If NOT IsNumeric(F_intAccessReadWrite_HttpProp) Then F_intAccessReadWrite_HttpProp = CONST_READ_PERMISSION ' read only permission End If ' initialize the status of CheckBoxes to "NOT CHECKED" F_strReadCheckStatus_HttpProp = CONST_CHECKBOX_NOT_SELECTED F_strWriteCheckStatus_HttpProp = CONST_CHECKBOX_NOT_SELECTED ' convert to integer type F_intAccessReadWrite_HttpProp = CInt(F_intAccessReadWrite_HttpProp) ' ' set the status of "CheckBoxes" if the values are set ' ' if the Read access is given. ' perform an AND to verify if the value is set If (F_intAccessReadWrite_HttpProp AND CONST_ACCESS_READ_ONLY) Then F_strReadCheckStatus_HttpProp = CONST_CHECKBOX_SELECTED End If ' if the write access is given. ' perform an AND to verify if the value is set If (F_intAccessReadWrite_HttpProp AND CONST_ACCESS_WRITE_ONLY) Then F_strWriteCheckStatus_HttpProp = CONST_CHECKBOX_SELECTED End If End Function '------------------------------------------------------------------------- ' Function name: HTTPOnInitPage ' Description: Serves in getting the values from system ' Input Variables: None ' Output Variables: None ' Returns: None ' Global Variables: ' Out: F_intAccessReadWrite_HttpProp - the access permissions ' Out: F_strReadCheckStatus_HttpProp - status of READ checkBox ' Out: F_strWriteCheckStatus_HttpProp - status of WRITE checkBox ' 'Status of checkBoxes = "CHECKED" or "" 'Support functions used: getHTTPShareObject() - to get the share object '------------------------------------------------------------------------- Function HTTPOnInitPage Err.Clear On Error Resume Next Dim objHTTPShare ' to get the share object for which we need to ' get the properties from ' initialize the checkbox status for all checkboxes as "not checked" F_strReadCheckStatus_HttpProp = CONST_CHECKBOX_NOT_SELECTED F_strWriteCheckStatus_HttpProp = CONST_CHECKBOX_NOT_SELECTED ' get the http share object from which we will get the properties Set objHTTPShare = getHTTPShareObject() ' get the access flags of the share F_intAccessReadWrite_HttpProp = CInt(objHTTPShare.AccessFlags) ' if read flag is set, the Read checkBox must be checked ' perform an AND to verify if the value is set If (F_intAccessReadWrite_HttpProp AND CONST_ACCESS_READ_ONLY) Then F_strReadCheckStatus_HttpProp = CONST_CHECKBOX_SELECTED End If ' if write flag is set, the Write checkBox must be checked ' perform an AND to verify if the value is set If (F_intAccessReadWrite_HttpProp AND CONST_ACCESS_WRITE_ONLY) Then F_strWriteCheckStatus_HttpProp = CONST_CHECKBOX_SELECTED End If ' clean up Set objHTTPShare = Nothing End Function '------------------------------------------------------------------------- ' Function name: SetHTTPshareProp ' Description: Serves in setting the values of the http share ' Input Variables: None ' Output Variables: None ' Returns: TRUE if successful, else FALSE ' Global Variables: ' In: L_* - Localization content(error messages) ' In: F_intAccessReadWrite_HttpProp - the access permissions ' (0,1,2 or 3 only) ' ' Support functions used: getHTTPShareObject() - to get the share object '------------------------------------------------------------------------- Function SetHTTPshareProp On Error Resume Next Err.Clear Dim objHTTPShare ' to get the share object for which we need to change properties Const CONST_ACCESSREAD="AccessRead" Const CONST_ACCESSWRITE="AccessWrite" ' get the HTTP share object for which we need to set properties Set objHTTPShare = getHTTPShareObject() ' It is enough to set the boolean values(AccessRead and AccessWrite). ' The AccessFlags(integer) need not be set.(wmi takes care of it) ' if the Read CheckBox is checked, set the flag to TRUE, else FALSE If (F_intAccessReadWrite_HttpProp AND CONST_ACCESS_READ_ONLY) Then objHTTPShare.Put CONST_ACCESSREAD,True Else objHTTPShare.Put CONST_ACCESSREAD,False End If ' if the Write CheckBox is checked, set the flag to TRUE, else FALSE If (F_intAccessReadWrite_HttpProp AND CONST_ACCESS_WRITE_ONLY) Then objHTTPShare.Put CONST_ACCESSWRITE,True Else objHTTPShare.Put CONST_ACCESSWRITE,False End If ' bring the changes made to properties to effect objHTTPShare.SetInfo() ' clean up Set objHTTPShare = Nothing ' in case of any error, return FALSE, else return TRUE If Err.number <> 0 Then ' the changes could not be PUT (system values could not be changed) SA_SetErrMsg L_FAILEDTOSETSHAREINFO_ERRORMESSAGE & " (" & Hex(Err.number) & ") " SetHTTPshareProp = False Exit Function Else SetHTTPshareProp = True End If End Function '------------------------------------------------------------------------- ' Function name: ServeHTTPHiddenValues ' Description: Serves in printing the hidden values of the form ' Input Variables: None ' Output Variables: None ' Returns: None ' Global Variables: ' In: F_intAccessReadWrite_HttpProp - the access permissions '------------------------------------------------------------------------- Function ServeHTTPHiddenValues ' the hidden values to store the access flag value ' (Whether the checkBoxes must be checked OR NOT) %> <% End Function %>