Hear us Roar
Article:
 |
|
ASP.NET Forms Authentication, Part 2
|
| Subject: |
|
VB Version of this code. |
| Date: |
|
2006-04-30 12:45:43 |
| From: |
|
erolsensoy
|
|
|
|
Thanks for simple and easy code. i'm take advantage this and working good. But i must use VB version of this code. i did translate to Vb version. May any visitors will take advantage.
Thanks.
// CODE STARTED HERE //
<%@ Import Namespace="System.Web.Security" %>
<%@ Import Namespace="System.Runtime.InteropServices" %>
<html>
<script language="VB" runat=server>
Declare Auto Function LogonUser Lib "advapi32.dll" _
(ByVal lpszUserName As String, _
ByVal lpszDomain As String, _
ByVal lpszPassword As String, _
ByVal dwLogonType As Integer, _
ByVal dwLogonProvider As Integer, _
ByRef phToken As Integer) As Integer
Public Const LOGON32_LOGON_INTERACTIVE As Integer = 2
Public Const LOGON32_PROVIDER_DEFAULT As Integer = 0
Protected Sub Login_Click(ByVal sender As Object, ByVal e As System.EventArgs)
Dim token As Integer
If (LogonUser(UserName.Value, _
UserDomain.Value, _
UserPass.Value, _
LOGON32_LOGON_INTERACTIVE, _
LOGON32_PROVIDER_DEFAULT, _
token) <> 0) Then
Session("useractive") = "active"
FormsAuthentication.RedirectFromLoginPage(UserName.Value, False)
Else
Session("useractive") = "notactive"
lblResults.Text = "Username and/or Password is wrong. Try Again."
End If
End Sub
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs)
UserName.Value = "MYUSERNAME" ' Not needed. require for only default value
UserDomain.Value = "MYDOMAIN" ' Not needed. require for only default value
End Sub
</script>
// CODE END HERE
|
Showing messages 1 through 1 of 1.
-
RE: VB Version of this code.
2006-07-25 07:02:12
AlohaMora
[View]
|
| |
I tried to use the VB code but it is not working, i did the steps as mentioned but all in vain. My Requirment is to open a login form as default page of the web application, user will pur username ppassword as in Active directory and it show be authanticated from AD database. and also i want to pick the user information like name phone address eamil etc from AD.
my email is itsrajiv@hotmail.com
plz send me ur i will send u the project and u can plz make changed for me.
thanks in advance i really need it working bec its my job requirment so plz help me