Click here to Skip to main content
15,887,746 members
Home / Discussions / Web Development
   

Web Development

 
QuestionServerside Form Posting Pin
Nic Rowan12-Jul-09 21:28
Nic Rowan12-Jul-09 21:28 
AnswerRe: Serverside Form Posting Pin
Marc Firth13-Jul-09 21:54
Marc Firth13-Jul-09 21:54 
QuestionClassic ASP and 'AJAX', and a database update Pin
AaronM_NZ12-Jul-09 15:22
AaronM_NZ12-Jul-09 15:22 
Question[Message Deleted] Pin
RichardBlank11-Jul-09 7:29
RichardBlank11-Jul-09 7:29 
AnswerRe: Work and play in Costa Rica? Pin
Christian Graus12-Jul-09 4:52
protectorChristian Graus12-Jul-09 4:52 
QuestionDisplay the contents in all resolution Pin
yesu prakash10-Jul-09 19:29
yesu prakash10-Jul-09 19:29 
AnswerRe: Display the contents in all resolution Pin
Christian Graus11-Jul-09 4:01
protectorChristian Graus11-Jul-09 4:01 
QuestionNeed help submitting values to Active Directory - Novice level Pin
kouts10-Jul-09 9:58
kouts10-Jul-09 9:58 
Hi guys,

I have the following code where I get values from the logged on user account profile in active directory, but I cannot seem to write back. When i click on the submit button, nothing happens, the page just refreshes. Please I need some help. This is my code:

Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load, Me.Load
If Page.IsPostBack Then

End If

Dim AD_entry As New DirectoryEntry("LDAP://")
Dim objSearcher As New System.DirectoryServices.DirectorySearcher(AD_entry)

'Find user id in Active Directory
Dim search As New System.DirectoryServices.DirectorySearcher(AD_entry)
search.Filter = [String].Format("(SAMAccountName={0})", System.Environment.UserName)
search.SearchScope = SearchScope.Subtree
search.PropertiesToLoad.Add("cn")
search.PropertiesToLoad.Add("mobile")
search.PropertiesToLoad.Add("facsimiletelephonenumber")
search.PropertiesToLoad.Add("homePhone")
search.PropertiesToLoad.Add("pager")
search.PropertiesToLoad.Add("mail")
search.PropertiesToLoad.Add("telephoneNumber")
search.PropertiesToLoad.Add("displayName")
Dim result As SearchResult = search.FindOne()
Dim ad_extension, ad_mobile, ad_home, ad_work, ad_fax, ad_displayName As String

If result.Properties.Contains("pager") Then
ad_extension = result.Properties("pager")(0)
Else
ad_extension = "---"
End If

If result.Properties.Contains("mobile") Then
ad_mobile = result.Properties("mobile")(0)
Else
ad_mobile = "---"
End If

If result.Properties.Contains("homePhone") Then
ad_home = result.Properties("homePhone")(0)
Else
ad_home = "---"
End If

If result.Properties.Contains("telephoneNumber") Then
ad_work = result.Properties("telephoneNumber")(0)
Else
ad_work = "---"
End If

If result.Properties.Contains("displayName") Then
ad_displayName = result.Properties("displayName")(0)
Else
ad_displayName = "---"
End If

If result.Properties.Contains("facsimiletelephonenumber") Then
ad_fax = result.Properties("facsimiletelephonenumber")(0)
Else
ad_fax = "---"
End If

label_user_id.Text = System.Environment.UserName
textbox_Extension.Text = ad_extension
textbox_Office_Phone.Text = ad_work
textbox_Mobile_Phone.Text = ad_mobile
textbox_Home_Phone.Text = ad_home
textbox_Fax.Text = ad_fax
textbox_displayName.Text = ad_displayName

'Set focus to Extension
' Page.RegisterStartupScript("SetFocus", _
' "<script>document.getElementById('" & textbox_Extension.ClientID & _
' "').focus();</script>")

End Sub

Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click

Dim dirEntry As New DirectoryEntry("LDAP://")
Dim dirSearcher As DirectorySearcher = New DirectorySearcher(dirEntry)

dirSearcher.Filter = [String].Format("(SAMAccountName={0})", System.Environment.UserName)
dirSearcher.SearchScope = SearchScope.Subtree
dirSearcher.PropertiesToLoad.Add("cn")
dirSearcher.PropertiesToLoad.Add("mobile")
dirSearcher.PropertiesToLoad.Add("facsimiletelephonenumber")
dirSearcher.PropertiesToLoad.Add("homePhone")
dirSearcher.PropertiesToLoad.Add("pager")
dirSearcher.PropertiesToLoad.Add("mail")
dirSearcher.PropertiesToLoad.Add("telephoneNumber")
dirSearcher.PropertiesToLoad.Add("displayName")
Dim searchResults As SearchResult = dirSearcher.FindOne()
Dim dirEntryResults As New DirectoryEntry(searchResults.Path)

If textbox_displayName.Text <> "---" Then
dirEntryResults.Properties("displayName").Value = textbox_displayName.Text
End If
If textbox_Office_Phone.Text <> "---" Then
dirEntryResults.Properties("telephoneNumber").Add(textbox_Office_Phone.Text)
End If

dirEntryResults.CommitChanges()

dirEntryResults.Close()
End Sub
Questionauthentification Pin
bhs200810-Jul-09 3:03
bhs200810-Jul-09 3:03 
AnswerRe: authentification Pin
CoderForEver10-Jul-09 8:12
CoderForEver10-Jul-09 8:12 
Questioncannot get nav menu to be top layer Pin
elfwitch9-Jul-09 7:17
elfwitch9-Jul-09 7:17 
AnswerRe: cannot get nav menu to be top layer Pin
Marc Firth9-Jul-09 22:16
Marc Firth9-Jul-09 22:16 
AnswerRe: cannot get nav menu to be top layer Pin
DoctorMick10-Jul-09 0:11
DoctorMick10-Jul-09 0:11 
QuestionBHO - Unable to upload file through IE8 Pin
Kevin Heathfield9-Jul-09 3:56
Kevin Heathfield9-Jul-09 3:56 
AnswerRe: BHO - Unable to upload file through IE8 Pin
Marc Firth9-Jul-09 22:22
Marc Firth9-Jul-09 22:22 
AnswerThis address uses a network port which is normally used for purposes other than Web browsing. Firefox has canceled the request for your protection : Firefox Port Problem Pin
Nilesh Thakkar9-Jul-09 0:57
Nilesh Thakkar9-Jul-09 0:57 
QuestionCan not connect to sql server database from web application(Configured in IIS) Pin
Hemant Thaker8-Jul-09 22:13
Hemant Thaker8-Jul-09 22:13 
AnswerRe: Can not connect to sql server database from web application(Configured in IIS) Pin
K03069-Jul-09 0:35
K03069-Jul-09 0:35 
Questioncombobox with postback Pin
shabonaa8-Jul-09 11:38
shabonaa8-Jul-09 11:38 
AnswerRe: combobox with postback Pin
Adam Maras8-Jul-09 12:22
Adam Maras8-Jul-09 12:22 
GeneralRe: combobox with postback Pin
shabonaa8-Jul-09 22:23
shabonaa8-Jul-09 22:23 
GeneralRe: combobox with postback Pin
Christian Graus9-Jul-09 4:03
protectorChristian Graus9-Jul-09 4:03 
AnswerRe: combobox with postback Pin
Jeremy Likness9-Jul-09 7:29
professionalJeremy Likness9-Jul-09 7:29 
GeneralRe: combobox with postback Pin
shabonaa9-Jul-09 8:38
shabonaa9-Jul-09 8:38 
QuestionHow to embed fonts in my website? Pin
CoderForEver8-Jul-09 5:18
CoderForEver8-Jul-09 5:18 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.