---
title: "Logga in mot server via ASP sida"
type: "forum-thread"
url: "https://www.webforum.nu/amne/asp/122658-logga-in-mot-server-via-asp-sida"
topic: "ASP"
topic_url: "https://www.webforum.nu/amne/asp"
author: "Fraggel"
published: "2005-02-17T14:34:16.000Z"
updated: "2005-02-17T14:47:49.000Z"
replies: 1
views: 252
page: 1
pages: 1
language: "sv-SE"
site: "webForum — webforum.nu"
rights: "Upphovsrätten till varje inlägg tillhör dess författare."
attribution: "Citera som: webForum, https://www.webforum.nu/amne/asp/122658-logga-in-mot-server-via-asp-sida"
---

# Logga in mot server via ASP sida

## #1 — Fraggel, 2005-02-17T14:34Z

Hur går jag tillväga var börjar jag ???

Mitt Problem

1\. Kund skall logga in med sitt anv och lösen som finns reggade i AD på en win2k3 maskin.
2\. I det läger om inloggningen är okej så skall det skickas en Engångskod till kundens mobil.
3\. Den skall inom 10 min knappas in annars så termineras sessionen och kunden får börja om...

steg 2 pch 3 är lösta. 
Jag hittar fan inte var jag skall börja läsa för att lyckas logga in mot domänen eller åtminstonde kolla om kontouppg stämmer eller inte.

Permalänk: https://www.webforum.nu/p/122658

## #2 — Jesper T, 2005-02-17T14:47Z

Kan detta vara ngt?

```
if request("GETUSER") = "" Then
    ' write out the test form 
		With Response
		.write "<FORM ACTION=USER.ASP METHOD=POST>"
		.Write "<INPUT TYPE=TEXT NAME=oDomain>ENTER DOMAIN<BR>"
		.write "<INPUT TYPE=TEXT NAME=oUSer>ENTER USER NAME TO CHECK<BR>"
		.write "<INPUT TYPE=PASSWORD NAME=oPassword>ENTER USER PASSWORD<BR>"
		.Write "<INPUT TYPE =SUBMIT NAME=GETUSER VALUE=CHECK>"
		.write "</FORM>"
		end with
	
	else
   ' Form was autopostback, grab the form variables ...
		  oDomain= Request("oDomain")
		  oUser = Request("oUser")
		  oPassword = Request("oPassword")
' begin "Kludge" VBScript error trapping  (see Javascript version fortry / catch handling)
on error resume next
' Set reference to the ADSI interface to NT User Manager ...
Set objUser = GetObject("WinNT://" & oDomain & "/" & oUser )

	if err.number <> 0 then
		Response.write "Login Error---"
		Response.end
	end if
	If len(objUser.FullName) < 1 then
			response.write "User Not Found!!!!"
			response.end
	else

on error resume next
' We verify the user password by using the ChangePassword method to change 
' the password back to itself.
' Since this requires that first parameter password be correct, it's an easy
'  way to circumvent the fact
' that NT won't give actual access to the user's password to make a comparison. 
' Be aware that on some systems,
' Admin policy settings may force the password 
' to have to be changed after X number of uses
' of this method...

  objUser.ChangePassword  oPassword, oPassword
	if err.number <> 0 then

		Response.write" BAD PASSWORD!"
		Response.end
	else  
 

' Now write out the ADSI User object properties that are supported by Windows 2000 ...

With Response
    .write "USER AUHTENTICATED!<BR>"
	.write "Properties for user " & objUser.FullName & ": <BR>"
	.Write "AccountExpirationDate: " & objUser.AccountExpirationDate & "<BR>" 
	.Write "BadLoginCount: " & objUser.BadLoginCount & "<BR>"
	.write "Description: " & objUser.Description & "<BR>"
	.write "HomeDirectory: " & objUser.HomeDirectory & "<BR>"
	.write "IsAccountLocked: " & objUser.IsAccountLocked & "<BR>"
	.write "LastLogin: " & objUser.LastLogin & "<BR>"
	.write "LastLogoff: " & objUser.LastLogoff & "<BR>"
	.write "LoginHours: " & objUser.LoginHours & "<BR>"
	.write "LoginScript: " & objUser.LoginScript & "<BR>"
	.write "LoginWorkstations: " & objUser.LoginWorkstations & "<BR>"
	.write "MaxStorage: " & objUser.MaxStorage &"<BR>"
	.write "PasswordExpirationDate: " & objUser.PasswordExpirationDate & "<BR>"
	.write "PasswordMinimumLength: " & objUser.PasswordMinimumLength & "<BR>"
	.write "PasswordRequired: " & objUser.PasswordRequired & "<BR>" 
	.write "Profile: " & objUser.Profile & "<BR>"
    .write "Account Disabled: " & objUser.AccountDisabled
end with
	
end if	

end if

end if
```

Permalänk: https://www.webforum.nu/p/1556330

---

Tråden på webben: https://www.webforum.nu/amne/asp/122658-logga-in-mot-server-via-asp-sida
