VBScript and asp...

L

Leszek

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
 
E

Evertjan.

Leszek wrote on 04 nov 2004 in microsoft.public.inetserver.asp.general:
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 NG is classic ASP only.

For ASP.net please ask a dot.net NG.
 
B

Bob Barrows [MVP]

Leszek said:
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.

There was no way for you to know it, but this is a classic asp newsgroup.
While you may be lucky enough to find a dotnet-savvy person here who can
answer your question, you can eliminate the luck factor by posting your
question to a newsgroup where the dotnet-savvy people hang out. I suggest
microsoft.public.dotnet.framework.aspnet.

Bob Barrows
 
L

Leszek

There i can ask about asp.net.
I want to do this by normal asp with VBScript. This is newsgroup for asp
(and optional VBScript or Javascript?)
And i made a mistake - paste wrong code. This is for VB.NET.
My code in vbscript looks something like that:

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

Function IsCScript()
If (InStr(UCase(WScript.FullName), "CSCRIPT") <> 0) Then
IsCScript = True
Else
IsCScript = False
End If
End Function
 
B

Bob Barrows [MVP]

Leszek said:
There i can ask about asp.net.
I want to do this by normal asp with VBScript.
Huh? I thought you said: "But i don't know how asimilate it with asp.net."
asp (and optional VBScript or Javascript?)
And i made a mistake - paste wrong code. This is for VB.NET.
My code in vbscript looks something like that:
<snip>

Please ask a specific question.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,904
Latest member
HealthyVisionsCBDPrice

Latest Threads

Top