Viewing source for Recipe2004VB.aspx

<%@ Page %>
<script Language="vb" runat="server">
Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs)
'Put user code to initialize the page here
'Note that this is getting a pre filtered result for the desired User
Dim User As System.DirectoryServices.DirectoryEntry
Try
User = New System.DirectoryServices.DirectoryEntry("LDAP://CN=Username, CN= users, DC=DomainName")
User.Properties("HomeNumber").Item(0) = "8501234567"
'Now that value contains the value of that property you can use it however you see fit.
'Note also that each property might contain more then one value depending on the property
'That is why we used a zero above in item to get the first value.
User.CommitChanges()
'This saves the changes
Catch
'Show error message
Finally
User.Close()
End Try
End Sub
</script>