M
Marek
Hello gurus!
I wrote a code in VBS, that will check, that current user is in one from
three groups.
But i don't know how asimilate it with asp.net.
This page will be a bridge between 2 - main menu and report page.
Tomorrow to the 8 a.m. i must do this, but i don't know how.... Can someone
help me?
There are few messageboxes for help.
Here is my code (it's vbs):
Sub Main
Dim objUserName, objUserDomain, oGroup, objUser, gList, WshShell, sMessage,
sTitle
Dim objDomain, vDomain, vUserName
Dim objChangePwdTrue, objChangePwd, objUserProfile
Dim objPwdExpiresTrue, objFlags
Dim objAcctDisabled, intPwdExpired, objPwdExpiredTrue
Dim admin, manag, audit
admin = false
manag = false
audit = false
Set WshShell = WshShell.CreateObject("WScript.Shell")
vdomain = WshShell.ExpandEnvironmentStrings("%USERDOMAIN%")
vUserName = Request.ServerVariables("USERNAME")
'Request.ServerVariables("REMOTE_USER")
GetInfo ' sub routing to get user information
For Each oGroup In objUser.Groups
If gList = "" Then
gList = oGroup.Name
Else
gList = gList & ", " & oGroup.Name
End If
Next
for each oGroup in objUser.Groups
if oGroup.Name = "Administrators" Then
admin = true
msgbox(ogroup.Name)
Else
End if
if ogroup.name = "ManagReports" Then
manag = true
msgbox(ogroup.name)
Else
End if
if ogroup.name = "AuditReports" Then
audit = true
msgbox(ogroup.name)
Else
End if
Next
dim a
If admin = true then
set a = RSExecute("menugl.html")
'FRAME SRC="menugl.htmL" NAME="Podstawowa"
'<FRAMESET>'</FRAMESET>
End if
msgbox(admin & " " & manag & " " & audit)
if znaleziona then
else
End if
end sub
Sub GetInfo()
sMessage = "Please enter the domain to search." & vbCrLf & vbCrLf & _
"Default is: " & vDomain & vbCrLf & vbCrLf
sMessage = sMessage & "Hit Cancel or enter a blank to quit"
sTitle = "Domain to Search"
If vDomain = "" Then ' Cancelled by the user
' WScript.quit
End If
ssMessage = ""
ssTitle = ""
on error resume Next
sMessage = "Please enter the USER Login ID" & vbCrLf & vbCrLf & _
"Default is: " & vUserName & vbCrLf & vbCrLf
sMessage = sMessage & "Hit Cancel or enter a blank to quit"
sTitle = "USER Login ID"
If vUserName = "" Then ' Cancelled by the user
WScript.quit
End If
Set objUser = GetObject("WinNT://"& vDomain &"/"& vUserName & "",user)
If Err Then
msgNoUser = "Error: Could not bind to the following user: " &
vbCrLf _
& vbCrLf & "WinNT://" & vDomain &"/"& vUserName & vbCrLf &
vbCrLf _
& "Please verify your domain and user name and try again"
WshShell.Popup msgNoUser,0,"Error retrieving
information",vbCritical
GetInfo
Else
End If
End Sub
Function IsCScript()
If (InStr(UCase(WScript.FullName), "CSCRIPT") <> 0) Then
IsCScript = True
Else
IsCScript = False
End If
End Function
I wrote a code in VBS, that will check, that current user is in one from
three groups.
But i don't know how asimilate it with asp.net.
This page will be a bridge between 2 - main menu and report page.
Tomorrow to the 8 a.m. i must do this, but i don't know how.... Can someone
help me?
There are few messageboxes for help.
Here is my code (it's vbs):
Sub Main
Dim objUserName, objUserDomain, oGroup, objUser, gList, WshShell, sMessage,
sTitle
Dim objDomain, vDomain, vUserName
Dim objChangePwdTrue, objChangePwd, objUserProfile
Dim objPwdExpiresTrue, objFlags
Dim objAcctDisabled, intPwdExpired, objPwdExpiredTrue
Dim admin, manag, audit
admin = false
manag = false
audit = false
Set WshShell = WshShell.CreateObject("WScript.Shell")
vdomain = WshShell.ExpandEnvironmentStrings("%USERDOMAIN%")
vUserName = Request.ServerVariables("USERNAME")
'Request.ServerVariables("REMOTE_USER")
GetInfo ' sub routing to get user information
For Each oGroup In objUser.Groups
If gList = "" Then
gList = oGroup.Name
Else
gList = gList & ", " & oGroup.Name
End If
Next
for each oGroup in objUser.Groups
if oGroup.Name = "Administrators" Then
admin = true
msgbox(ogroup.Name)
Else
End if
if ogroup.name = "ManagReports" Then
manag = true
msgbox(ogroup.name)
Else
End if
if ogroup.name = "AuditReports" Then
audit = true
msgbox(ogroup.name)
Else
End if
Next
dim a
If admin = true then
set a = RSExecute("menugl.html")
'FRAME SRC="menugl.htmL" NAME="Podstawowa"
'<FRAMESET>'</FRAMESET>
End if
msgbox(admin & " " & manag & " " & audit)
if znaleziona then
else
End if
end sub
Sub GetInfo()
sMessage = "Please enter the domain to search." & vbCrLf & vbCrLf & _
"Default is: " & vDomain & vbCrLf & vbCrLf
sMessage = sMessage & "Hit Cancel or enter a blank to quit"
sTitle = "Domain to Search"
If vDomain = "" Then ' Cancelled by the user
' WScript.quit
End If
ssMessage = ""
ssTitle = ""
on error resume Next
sMessage = "Please enter the USER Login ID" & vbCrLf & vbCrLf & _
"Default is: " & vUserName & vbCrLf & vbCrLf
sMessage = sMessage & "Hit Cancel or enter a blank to quit"
sTitle = "USER Login ID"
If vUserName = "" Then ' Cancelled by the user
WScript.quit
End If
Set objUser = GetObject("WinNT://"& vDomain &"/"& vUserName & "",user)
If Err Then
msgNoUser = "Error: Could not bind to the following user: " &
vbCrLf _
& vbCrLf & "WinNT://" & vDomain &"/"& vUserName & vbCrLf &
vbCrLf _
& "Please verify your domain and user name and try again"
WshShell.Popup msgNoUser,0,"Error retrieving
information",vbCritical
GetInfo
Else
End If
End Sub
Function IsCScript()
If (InStr(UCase(WScript.FullName), "CSCRIPT") <> 0) Then
IsCScript = True
Else
IsCScript = False
End If
End Function