473,327 Members | 2,071 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,327 software developers and data experts.

VBScript and asp...

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

Jul 21 '05 #1
5 2109
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.

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress,
but let us keep the discussions in the newsgroup)

Jul 21 '05 #2
Leszek wrote:
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

--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.
Jul 21 '05 #3
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

U¿ytkownik "Bob Barrows [MVP]" <re******@NOyahoo.SPAMcom> napisa³ w
wiadomo¶ci news:uv**************@TK2MSFTNGP12.phx.gbl...
Leszek wrote:
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

--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.

Jul 21 '05 #4

Leszek wrote:
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.
--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.
Jul 21 '05 #5
Hi Leszek,

http://www.aspfaq.com/5003

Ray at work

"Leszek" <ma***@zegarek.pl> wrote in message
news:OZ**************@TK2MSFTNGP15.phx.gbl...
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.

Jul 21 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: John Davis | last post by:
When I create new documents in Dreamweaver, there are several choices for ASP creation: ASP JavaScript: run at client side?? ASP VBScript: run at server side?? ASP.NET C# ASP.NET VB I don't...
29
by: Christopher Brandsdal | last post by:
If I have a .ASP page that runs JScript code - is it possible to include an ..ASP page that runs VBscript???
20
by: Harag | last post by:
Hi All. I'm stating out doing some web developing. I was wondering which of the server side languages should I concentrate on and learn. I Know CSS, HTML, T-SQL I can look at the client...
16
by: Mike Schinkel | last post by:
Does anyone know if there are bugs in VBScript's GetRef()? I'm using VBScript Version 5.6.8515 on Win2003Server w/ASP. Sometimes it returns an object that VarType() says is a vbObject. Other...
5
by: gpence | last post by:
!!! Newbie question warning !!! I am somewhat familiar with javascript's ability to "access" the browser's favorites list -- for example, using window.home() will take you to the default URL --...
4
by: chris.dunigan | last post by:
I'm looking for an example of how to execute an existing DTS­ package from an ASP (VB)script and would appreciate any and all response. ­I don't even know if it's possible Thanks - Chuck...
2
by: Frank | last post by:
Can I do this? I add a session var in C# and ultimatly want to pass it into a vbscript client side activeX control. This is what I have so far but get " Object Required:'name2' " error. Can...
7
by: skeddy | last post by:
In a nutshell, I'm trying to dynamically create a select box with ResultSet code in vbscript and then need to be able to access the value of that select box later with a Save button. I've got...
10
by: Shadow Lynx | last post by:
That subject packs a whallop, so let me explain in better detail what's happening and how it relates to ASPX pages... In a nutshell, if the first <script /on a page is of type "text/vbscript",...
6
by: rishabhshrivastava | last post by:
Hello All, I am using ASP.NET 2.0 and I am experiencing a problem using vbscript that is this script on client side is preventing the postback of my controls. I have a dropdownlist which is...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.