Register Register Member Login Member Login Member Login Forgot Password ??
PHP , ASP , ASP.NET, VB.NET, C#, Java , jQuery , Android , iOS , Windows Phone
 

Registered : 109,027

HOME > .NET Framework > Forum > สอบถามเรื่อง User Authentication Active Directory ถ้ามีการเช็คหลายPATH ไม่ทราบว่าต้องเช็คยังไงหรอครับ



 

สอบถามเรื่อง User Authentication Active Directory ถ้ามีการเช็คหลายPATH ไม่ทราบว่าต้องเช็คยังไงหรอครับ

 



Topic : 120615



โพสกระทู้ ( 90 )
บทความ ( 0 )



สถานะออฟไลน์




Code (VB.NET)
 Dim initLDAPPath As String = "DC=opsd,DC=net"
    Dim initLDAPServer As String = "10.0.4.32"
    Dim initShortDomainName As String = "OPSD"


ตรงส่วนนี้นะครับ ถ้ามันมีหลาย Path อะครับ ไม่ทราบว่าต้องเช็คยังไงหรอครับ
ถึงจะครอบคุม



Tag : .NET, VB.NET







Move To Hilight (Stock) 
Send To Friend.Bookmark.
Date : 2015-12-23 11:56:52 By : omyam001 View : 903 Reply : 6
 

 

No. 1



โพสกระทู้ ( 74,058 )
บทความ ( 838 )

สมาชิกที่ใส่เสื้อไทยครีเอท

สถานะออฟไลน์
Twitter Facebook

ทำหลายรอบครับ






แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2015-12-23 11:58:47 By : mr.win
 


 

No. 2



โพสกระทู้ ( 4,436 )
บทความ ( 23 )



สถานะออฟไลน์
Facebook

ggg
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2015-12-23 16:49:58 By : lamaka.tor
 

 

No. 3



โพสกระทู้ ( 90 )
บทความ ( 0 )



สถานะออฟไลน์


มันคืออะไรหรอครับพี่ TOR_CHEMISTRY ผมยังไม่ค่อยเก่งเท่าไหร่อะครับ

ตอนแรกกะจะ เอาไปอยู่ใน IF ที่มัน false อะครับผม แต่ถ้าทำ มันจะ query ช้าไหมครับ


ถ้าเป็นแบบข้างล่าง ผมจะเปลี่ยนที่ยังไงหรอครับ

Code (VB.NET)
Protected Sub btnLogin_Click(ByVal sender As Object, ByVal e As System.EventArgs)

public Notinheritable Class PathActive
Dim initLDAPPath As String = "DC=opsd,DC=net"
Dim initLDAPServer As String = "10.0.4.32"
Dim initShortDomainName As String = "OPSD"

end class

public Notinheritable Class PathActive1
Dim initLDAPPath1 As String = "DC=test,DC=net"
Dim initLDAPServer1 As String = "1.0.0.33"
Dim initShortDomainName1 As String = "test"
end class 

strCommu = "LDAP://" & initLDAPServer & "/" & initLDAPPath
DomainAndUsername = initShortDomainName & "\" & txtUser.Text
Dim entry As New DirectoryEntry(strCommu, DomainAndUsername, txtPwd.Text)
Dim obj As Object

Try

obj = entry.NativeObject

Dim search As New DirectorySearcher(entry)

Dim result As SearchResult

search.Filter = "(SAMAccountName=" + txtUser.Text + ")"

search.PropertiesToLoad.Add("cn")

result = search.FindOne()

If result Is Nothing Then

flgLogin = False

strErrMsg = "Please check user/password"

Else

flgLogin = True
End If
Catch ex As Exception
flgLogin = False
strErrMsg = "Please check user/password"
End Try

IF flgLogin = True
Me.lbDisplay.Text = "Welcome " & txtUser.Text

Else
Me.lbDisplay.Text = strErrMsg
End IF

End Sub




ประวัติการแก้ไข
2015-12-23 21:40:07
2015-12-23 21:47:11
2015-12-23 21:49:46
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2015-12-23 21:38:23 By : omyam001
 


 

No. 4



โพสกระทู้ ( 90 )
บทความ ( 0 )



สถานะออฟไลน์


หรือต้องแบบนี้ครับ

Code (VB.NET)
Protected Sub btnLogin_Click(ByVal sender As Object, ByVal e As System.EventArgs)


Dim initLDAPPath As String = "DC=opsd,DC=net"
Dim initLDAPServer As String = "10.0.4.32"
Dim initShortDomainName As String = "OPSD"


Dim initLDAPPath1 As String = "DC=test,DC=net"
Dim initLDAPServer1 As String = "1.0.0.33"
Dim initShortDomainName1 As String = "test"


strCommu = "LDAP://" & initLDAPServer & "/" & initLDAPPath
DomainAndUsername = initShortDomainName & "\" & txtUser.Text
Dim entry As New DirectoryEntry(strCommu, DomainAndUsername, txtPwd.Text)
Dim obj As Object

Try

obj = entry.NativeObject

Dim search As New DirectorySearcher(entry)

Dim result As SearchResult

search.Filter = "(SAMAccountName=" + txtUser.Text + ")"

search.PropertiesToLoad.Add("cn")

result = search.FindOne()

If result Is Nothing Then

flgLogin = False

strErrMsg = "Please check user/password" ' เอามาไว้ข้างในแบบนี้เลยหรอครับ


Dim initLDAPPath1 As String = "DC=test,DC=net"
Dim initLDAPServer1 As String = "1.0.0.33"
Dim initShortDomainName1 As String = "test"


strCommu = "LDAP://" & initLDAPServer & "/" & initLDAPPath
DomainAndUsername = initShortDomainName & "\" & txtUser.Text
Dim entry As New DirectoryEntry(strCommu, DomainAndUsername, txtPwd.Text)
Dim obj As Object

Try

obj = entry.NativeObject

Dim search As New DirectorySearcher(entry)

Dim result As SearchResult

search.Filter = "(SAMAccountName=" + txtUser.Text + ")"

search.PropertiesToLoad.Add("cn")

result = search.FindOne()

If result Is Nothing Then

flgLogin = False

strErrMsg = "Please check user/password"

Else

flgLogin = True
End If
Catch ex As Exception
flgLogin = False
strErrMsg = "Please check user/password"
End Try

IF flgLogin = True
Me.lbDisplay.Text = "Welcome " & txtUser.Text

Else
Me.lbDisplay.Text = strErrMsg
End IF

Else

flgLogin = True
End If
Catch ex As Exception
flgLogin = False
strErrMsg = "Please check user/password"
End Try

IF flgLogin = True
Me.lbDisplay.Text = "Welcome " & txtUser.Text

Else
Me.lbDisplay.Text = strErrMsg
End IF

End Sub

แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2015-12-23 21:51:11 By : omyam001
 


 

No. 5



โพสกระทู้ ( 4,436 )
บทความ ( 23 )



สถานะออฟไลน์
Facebook

ยกตัวอย่างเพื่อเอาเอา class มาทำเป็น list ครับ
สร้าง class แยกออกมา
Code (VB.NET)
Public NotInheritable Class PathActive
    Public Shared initLDAPPath As String = "DC=opsd,DC=net"
    Public Shared initLDAPServer As String = "10.0.4.32"
    Public Shared initShortDomainName As String = "OPSD"
    Public Shared initLDAPPath1 As String = "DC=opsd,DC=net"
    Public Shared initLDAPServer1 As String = "10.0.4.1"
    Public Shared initShortDomainName1 As String = "test1"
    Public Shared initLDAPPath2 As String = "DC=opsd,DC=net"
    Public Shared initLDAPServer2 As String = "10.0.4.2"
    Public Shared initShortDomainName3 As String = "test2"


End Class




Code (VB.NET)
Protected Sub btnLogin_Click(ByVal sender As Object, ByVal e As System.EventArgs)
       strCommu = "LDAP://" & PathActive.initLDAPServer & "/" & PathActive.initLDAPPath
        DomainAndUsername = PathActive.initShortDomainName & "\" & txtUser.Text
        Dim entry As New DirectoryEntry(strCommu, DomainAndUsername, txtPwd.Text)

End Sub



ประมาณนี้ครับ
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2015-12-25 08:39:15 By : lamaka.tor
 


 

No. 6



โพสกระทู้ ( 90 )
บทความ ( 0 )



สถานะออฟไลน์


แล้วตรงไหนที่ มัน เปรียบเทียบกันหรอครับ ยังมองภาพไม่เลยงับผม

ของผม แค่ initLDAPServer เปลี่ยนเท่านั้นเองครับ นอกนั้นเหมือนเดิมหมด

ยังติดตรง initLDAPServer initLDAPServer1 จะเปรียบเทียบยังไงหรอครับ
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2015-12-25 17:36:05 By : omyam001
 

   

ค้นหาข้อมูล


   
 

แสดงความคิดเห็น
Re : สอบถามเรื่อง User Authentication Active Directory ถ้ามีการเช็คหลายPATH ไม่ทราบว่าต้องเช็คยังไงหรอครับ
 
 
รายละเอียด
 
ตัวหนา ตัวเอียง ตัวขีดเส้นใต้ ตัวมีขีดกลาง| ตัวเรืองแสง ตัวมีเงา ตัวอักษรวิ่ง| จัดย่อหน้าอิสระ จัดย่อหน้าชิดซ้าย จัดย่อหน้ากึ่งกลาง จัดย่อหน้าชิดขวา| เส้นขวาง| ขนาดตัวอักษร แบบตัวอักษร
ใส่แฟลช ใส่รูป ใส่ไฮเปอร์ลิ้งค์ ใส่อีเมล์ ใส่ลิ้งค์ FTP| ใส่แถวของตาราง ใส่คอลัมน์ตาราง| ตัวยก ตัวห้อย ตัวพิมพ์ดีด| ใส่โค้ด ใส่การอ้างถึงคำพูด| ใส่ลีสต์
smiley for :lol: smiley for :ken: smiley for :D smiley for :) smiley for ;) smiley for :eek: smiley for :geek: smiley for :roll: smiley for :erm: smiley for :cool: smiley for :blank: smiley for :idea: smiley for :ehh: smiley for :aargh: smiley for :evil:
Insert PHP Code
Insert ASP Code
Insert VB.NET Code Insert C#.NET Code Insert JavaScript Code Insert C#.NET Code
Insert Java Code
Insert Android Code
Insert Objective-C Code
Insert XML Code
Insert SQL Code
Insert Code
เพื่อความเรียบร้อยของข้อความ ควรจัดรูปแบบให้พอดีกับขนาดของหน้าจอ เพื่อง่ายต่อการอ่านและสบายตา และตรวจสอบภาษาไทยให้ถูกต้อง

อัพโหลดแทรกรูปภาพ

Notice

เพื่อความปลอดภัยของเว็บบอร์ด ไม่อนุญาติให้แทรก แท็ก [img]....[/img] โดยการอัพโหลดไฟล์รูปจากที่อื่น เช่นเว็บไซต์ ฟรีอัพโหลดต่าง ๆ
อัพโหลดแทรกรูปภาพ ให้ใช้บริการอัพโหลดไฟล์ของไทยครีเอท และตัดรูปภาพให้พอดีกับสกรีน เพื่อความโหลดเร็วและไฟล์ไม่ถูกลบทิ้ง

   
  เพื่อความปลอดภัยและการตรวจสอบ กระทู้ที่แทรกไฟล์อัพโหลดไฟล์จากที่อื่น อาจจะถูกลบทิ้ง
 
โดย
อีเมล์
บวกค่าให้ถูก
<= ตัวเลขฮินดูอารบิก เช่น 123 (หรือล็อกอินเข้าระบบสมาชิกเพื่อไม่ต้องกรอก)







Exchange: นำเข้าสินค้าจากจีน, Taobao, เฟอร์นิเจอร์, ของพรีเมี่ยม, ร่ม, ปากกา, power bank, แฟลชไดร์ฟ, กระบอกน้ำ

Load balance : Server 02
ThaiCreate.Com Logo
© www.ThaiCreate.Com. 2003-2024 All Rights Reserved.
ไทยครีเอทบริการ จัดทำดูแลแก้ไข Web Application ทุกรูปแบบ (PHP, .Net Application, VB.Net, C#)
[Conditions Privacy Statement] ติดต่อโฆษณา 081-987-6107 อัตราราคา คลิกที่นี่