Web Wiz - Green Windows Web Hosting

  New Posts New Posts RSS Feed - Check password against windows 2000
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Check password against windows 2000

 Post Reply Post Reply
Author
seidren View Drop Down
Newbie
Newbie


Joined: 08 August 2003
Location: Sri Lanka
Status: Offline
Points: 3
Post Options Post Options   Thanks (0) Thanks(0)   Quote seidren Quote  Post ReplyReply Direct Link To This Post Topic: Check password against windows 2000
    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

Back to Top
WebWiz-Bruce View Drop Down
Admin Group
Admin Group
Avatar
Web Wiz Developer

Joined: 03 September 2001
Location: Bournemouth
Status: Offline
Points: 9844
Post Options Post Options   Thanks (0) Thanks(0)   Quote WebWiz-Bruce Quote  Post ReplyReply Direct Link To This Post 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.
Back to Top
seidren View Drop Down
Newbie
Newbie


Joined: 08 August 2003
Location: Sri Lanka
Status: Offline
Points: 3
Post Options Post Options   Thanks (0) Thanks(0)   Quote seidren Quote  Post ReplyReply Direct Link To This Post 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.

Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.08
Copyright ©2001-2026 Web Wiz Ltd.


Become a Fan on Facebook Follow us on X Connect with us on LinkedIn Web Wiz Blogs
About Web Wiz | Contact Web Wiz | Terms & Conditions | Cookies | Privacy Notice

Web Wiz is the trading name of Web Wiz Ltd. Company registration No. 05977755. Registered in England and Wales.
Registered office: Web Wiz Ltd, Unit 18, The Glenmore Centre, Fancy Road, Poole, Dorset, BH12 4FB, UK.

Prices exclude VAT at 20% unless otherwise stated. VAT No. GB988999105 - $, € prices shown as a guideline only.

Copyright ©2001-2026 Web Wiz Ltd. All rights reserved.