Print Page | Close Window

Check password against windows 2000

Printed From: Web Wiz Forums
Category: Web Wiz Web App Support Forums
Forum Name: Web Wiz Forums
Forum Description: Support forum for Web Wiz Forums application.
URL: https://forums.webwiz.net/forum_posts.asp?TID=4859
Printed Date: 02 April 2026 at 4:24pm
Software Version: Web Wiz Forums 12.08 - https://www.webwizforums.com


Topic: Check password against windows 2000
Posted By: seidren
Subject: Check password against windows 2000
Date Posted: 08 August 2003 at 2:40am

I dont know where to post this message so here it goes.

I am setting up a forum on my lan. I dont want my users to register to access the forums. The usernames and the encrypted passwords are stored in a Windows 2000 server. So what I want is to make the users login without registering. The username and password should be checked against the ones in the Windows 2000 server.

I dont know how to do this. Could anyone please help me out with this.

Thanks,

Denesh.R




Replies:
Posted By: WebWiz-Bruce
Date Posted: 08 August 2003 at 7:29am
If you do a search of the forum there are a number of posts on this issue as I don't have the time at the moment to run through how to alter it for NT authentication at the moment.

-------------
https://www.webwiz.net/web-wiz-forums/forum-hosting.htm" rel="nofollow - Web Wiz Forums Hosting
https://www.webwiz.net/web-hosting/windows-web-hosting.htm" rel="nofollow - ASP.NET Web Hosting


Posted By: seidren
Date Posted: 12 August 2003 at 2:28am

Hey guys,

I figured out how to do this and i hope that anyone else who stumbles upon this problem will find this solution usefull

This code is supposed to work in the Windows 2000 as well as Window NT.

I use a function which changes the password. The function needs the Old Password as well as the new password. So the trick is to pass the old password for both parameters so the actual password will not be changed. The function itself will first validate the oldpassword. So we end up having a function that validates the usernam and password entered.

This code should explain it all.

I put this bit in the register.asp file

 '******************************************
 '***   Check Password Against Windows ***
 '******************************************

 'If in update mode we dont have to check password against windows
 
If strMode <> "update" then
 Dim NTServerName, Uname, Passwd, objUser, ErrorCode

 NTServerName = "cateye"

 Uname = strUsername
 Passwd = strPassword


 On Error Resume Next
 Set objUser = GetObject("WinNT://" & NTServerName & "/" & Uname & ",user")

 objUser.ChangePassword Passwd, Passwd
 If Err <> 0 Then
  If CLng(Err.Number) = CLng(-2147024810) Then
   ErrorCode = "Your password was incorrect. Enter the password that you use to logon to the network"

   Response.Write("<script Language=""VBScript"">" & vbCRLF)   
   Response.write("MsgBox """ & ErrorCode & """,,""Invalid Password""" & vbCRLF)
   Response.Write("Parent.Navigate ""default.asp""" & vbCRLF)
   Response.Write("</script>" & vbCRLF)
   Response.End
  ELSEif Clng(Err.Number) = CLng(424) Then
   ErrorCode = "Invalid User Name. Enter the username that you use to logon to the network"

   Response.Write("<script Language=""VBScript"">" & vbCRLF)   
   Response.write("MsgBox """ & ErrorCode & """,,""Invalid Username""" & vbCRLF)
   Response.Write("Parent.Navigate ""default.asp""" & vbCRLF)
   Response.Write("</script>" & vbCRLF)
   Response.End
  Else
   ErrorCode = "An unexpected error has occured. Please try again"

   Response.Write("<script Language=""VBScript"">" & vbCRLF)   
   Response.write("MsgBox """ & ErrorCode & """,,""Unknown Error""" & vbCRLF)
   Response.Write("Parent.Navigate ""default.asp""" & vbCRLF)
   Response.Write("</script>" & vbCRLF)
   Response.End
  END IF

 ELSE
  ErrorCode = "You have been authenticated successfully"
 End If

End if

If anyone can improve this code then please let me know

Thanks.




Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.08 - https://www.webwizforums.com
Copyright ©2001-2026 Web Wiz Ltd. - https://www.webwiz.net