SELECT SCHEMA_NAME(schema_id) AS schema_name,name AS view_name,OBJECTPROPERTYEX(OBJECT_ID,'IsIndexed') AS IsIndexed,OBJECTPROPERTYEX(OBJECT_ID,'IsIndexable') AS IsIndexable--,*FROM sys.views;GO
Oppure leggere qui
http://support.microsoft.com/kb/186246/it
Visualizzazione post con etichetta asp. Mostra tutti i post
Visualizzazione post con etichetta asp. Mostra tutti i post
2012/09/19
2011/06/14
Formattare su 6 cifre un numero intero tramite padding con zero
e ci ho perso alcuni minuti di troppo! Auch!
Mi serviva una funzione che prendendo in ingresso 34 mi restituisse 0034
Banalmente...
id=34
right("00000000" & id, 6)
ed il gioco è fatto!!
ASP: Autenticazione su dominio WINDOWS
Ecco come son riuscito a verificare una utenza su dominio.
La funzione controlla USERNAME/PASSORD ma anche l'appartenenza o meno ad un gruppo.
Se il gruppo è passato come vuoto "" la procedura verifica solo USER/PASSORD
<%@Language="VBScript"%>
<%
'USAGE
'response.write (validateUserAndGroup("domain", "username","password","thegroup"))
'return value: 0=SUCCESS 1=FAIL
function validateUserAndGroup(domainname,strUsername,strpassword,theTeamName)
'Avoid error messages
on error resume next
' VERIFICA USERNAME/PASSWORD
Set objDomain = GetObject ("LDAP://rootDSE")
objADsPath = objDomain.Get("defaultNamingContext")
Set objDomain = Nothing
Set objConnection = Server.CreateObject("ADODB.Connection")
objConnection.provider ="ADsDSOObject"
objConnection.Properties("User ID") = domainname+"\" + strUsername
objConnection.Properties("Password") = strpassword
objConnection.open "Active Directory Provider"
Set objCommand = CreateObject("ADODB.Command")
Set objCommand.ActiveConnection = objConnection
objCommand.CommandText ="select cn FROM 'LDAP://"+objADsPath+"' where sAMAccountname='"+strUsername+"'"
Set objRS = objCommand.Execute
If Err.Number <> 0 Then
' USER NOT VALID : FAIL
'response.write ("USER NOT VALID: FAIL")
validateUserAndGroup=1
Exit Function
Else
if theTeamName="" then
' GROUP NOT TO BE CHECKED
' USER VALID : SUCCESS
'response.write ("USER VALID: Group Not Needed")
validateUserAndGroup=0
Exit Function
else
' GROUP MUST BE CHECKED
objCommand.CommandText ="select memberOf FROM 'LDAP://"+objADsPath+"' where sAMAccountname='"+strUsername+"'"
'response.write objCommand.CommandText &"
"
Set rs = objCommand.Execute
membership=rs("memberof")
rs.Close
objConnection.Close
Set rs = Nothing
Set objConnection = Nothing
For each group in membership
newgroup=split(group,"=")
tempgroup=left(newgroup(1), len(newgroup(1))-3)
tempgroup=lcase(tempgroup)
If tempgroup=TheTeamName Then
' GROUP VALID : SUCCESS
validateUserAndGroup=0
Exit Function
End If
Next
end if
End If
' GROUP NOT VALID : FAIL
'response.write ("GROUP NOT VALID: FAIL")
validateUserAndGroup=1
end function
%>
Se il gruppo è passato come vuoto "" la procedura verifica solo USER/PASSORD
Ganzo!
<%@Language="VBScript"%>
<%
'USAGE
'response.write (validateUserAndGroup("domain", "username","password","thegroup"))
'return value: 0=SUCCESS 1=FAIL
function validateUserAndGroup(domainname,strUsername,strpassword,theTeamName)
'Avoid error messages
on error resume next
' VERIFICA USERNAME/PASSWORD
Set objDomain = GetObject ("LDAP://rootDSE")
objADsPath = objDomain.Get("defaultNamingContext")
Set objDomain = Nothing
Set objConnection = Server.CreateObject("ADODB.Connection")
objConnection.provider ="ADsDSOObject"
objConnection.Properties("User ID") = domainname+"\" + strUsername
objConnection.Properties("Password") = strpassword
objConnection.open "Active Directory Provider"
Set objCommand = CreateObject("ADODB.Command")
Set objCommand.ActiveConnection = objConnection
objCommand.CommandText ="select cn FROM 'LDAP://"+objADsPath+"' where sAMAccountname='"+strUsername+"'"
Set objRS = objCommand.Execute
If Err.Number <> 0 Then
' USER NOT VALID : FAIL
'response.write ("USER NOT VALID: FAIL")
validateUserAndGroup=1
Exit Function
Else
if theTeamName="" then
' GROUP NOT TO BE CHECKED
' USER VALID : SUCCESS
'response.write ("USER VALID: Group Not Needed")
validateUserAndGroup=0
Exit Function
else
' GROUP MUST BE CHECKED
objCommand.CommandText ="select memberOf FROM 'LDAP://"+objADsPath+"' where sAMAccountname='"+strUsername+"'"
'response.write objCommand.CommandText &"
"
Set rs = objCommand.Execute
membership=rs("memberof")
rs.Close
objConnection.Close
Set rs = Nothing
Set objConnection = Nothing
For each group in membership
newgroup=split(group,"=")
tempgroup=left(newgroup(1), len(newgroup(1))-3)
tempgroup=lcase(tempgroup)
If tempgroup=TheTeamName Then
' GROUP VALID : SUCCESS
validateUserAndGroup=0
Exit Function
End If
Next
end if
End If
' GROUP NOT VALID : FAIL
'response.write ("GROUP NOT VALID: FAIL")
validateUserAndGroup=1
end function
%>
Iscriviti a:
Post (Atom)

