Can someone help me? (code here)

Discussion in 'ASP .Net' started by Marek, Nov 4, 2004.

  1. Marek

    Marek Guest

    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
     
    Marek, Nov 4, 2004
    #1
    1. Advertisements

  2. I'm afraid it's not that easy, Marek. You're talking aobut 2 completely
    different programming paradigms here. ASP is scripted and procedural.
    ASP.Net is a fully-compiled programming technology which is object-oriented.

    If your deadline is tomorrow morning, I believe you have 2 choices:

    1. Stick with the ASP and make it work.
    2. Look for another job.

    --
    HTH,
    Kevin Spencer
    ..Net Developer
    Microsoft MVP
    I get paid good money to
    solve puzzles for a living
     
    Kevin Spencer, Nov 4, 2004
    #2
    1. Advertisements

  3. Marek

    Leszek Guest

    Ok :/
    So, can you give me a link with walkthrought, that clearly shows how to
    build it in asp.net?
     
    Leszek, Nov 4, 2004
    #3
  4. Kevin Spencer, Nov 4, 2004
    #4
    1. Advertisements

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 (here). After that, you can post your question and our members will help you out.