Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 6 of 6

Thread: ASP Question

  1. #1
    New Coder
    Join Date
    Jan 2003
    Location
    Georgia
    Posts
    50
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question ASP Question

    I am in the midst of recreating the asp portion of the website and a question came to mind –
    Can you do a permission set up like this? I am trying to have a single asp page but different users see different things. I read Michael Brinks article on single asp pages, I understand that but how do implement permissions like below? I currently have the pages set up by redirecting them to a different asp page based on their permissions but I need to do it this way. Any help would be greatly appreciated.

    Code:
    <%
    If Session (“name”) = “Admin”
     SELECT Case strNav
       Case "", "main" ' Default
          Server.Execute("inc_mainNav.asp")
       Case "client"
          Server.Execute("inc_clientNav.asp")
       Case "sales"
          Server.Execute("inc_salesNav.asp")
       Case Else
          Server.Execute("Error.asp")
    End Select
    
    If Session (“name”) = “Teacher”
     SELECT Case strNav
       Case "", "main" ' Default
          Server.Execute("inc_mainNav.asp")
       Case "client"
          Server.Execute("inc_clientNav.asp")
       Case "sales"
          Server.Execute("inc_salesNav.asp")
       Case Else
          Server.Execute("Error.asp")
    End Select
    
    If Session (“name”) = “student”
     SELECT Case strNav
       Case "", "main" ' Default
          Server.Execute("inc_mainNav.asp")
       Case "client"
          Server.Execute("inc_clientNav.asp")
       Case "sales"
          Server.Execute("inc_salesNav.asp")
       Case Else
          Server.Execute("Error.asp")
    End Select
    
    If Session (“name”) = “parent”
     SELECT Case strNav
       Case "", "main" ' Default
          Server.Execute("inc_mainNav.asp")
       Case "client"
          Server.Execute("inc_clientNav.asp")
       Case "sales"
          Server.Execute("inc_salesNav.asp")
       Case Else
          Server.Execute("Error.asp")
    End Select
    %>
    Basically, each of those statements would all house a different set of viewable properties per user. If there are questions I am not answering, please let me know.

    Thank you in advance.

  • #2
    New Coder
    Join Date
    Jan 2003
    Location
    Peterborough, UK
    Posts
    39
    Thanks
    0
    Thanked 0 Times in 0 Posts
    It's not very pretty, but it should work with a few tweaks:


    <%
    If Session (“name”) = “Admin”
    SELECT Case strNav
    Case "", "main" ' Default
    Server.Execute("inc_mainNav.asp")
    Case "client"
    Server.Execute("inc_clientNav.asp")
    Case "sales"
    Server.Execute("inc_salesNav.asp")
    Case Else
    Server.Execute("Error.asp")
    End Select

    ElseIf Session (“name”) = “Teacher”
    SELECT Case strNav
    Case "", "main" ' Default
    Server.Execute("inc_mainNav.asp")
    Case "client"
    Server.Execute("inc_clientNav.asp")
    Case "sales"
    Server.Execute("inc_salesNav.asp")
    Case Else
    Server.Execute("Error.asp")
    End Select

    ElseIf Session (“name”) = “student”
    SELECT Case strNav
    Case "", "main" ' Default
    Server.Execute("inc_mainNav.asp")
    Case "client"
    Server.Execute("inc_clientNav.asp")
    Case "sales"
    Server.Execute("inc_salesNav.asp")
    Case Else
    Server.Execute("Error.asp")
    End Select

    ElseIf Session (“name”) = “parent”
    SELECT Case strNav
    Case "", "main" ' Default
    Server.Execute("inc_mainNav.asp")
    Case "client"
    Server.Execute("inc_clientNav.asp")
    Case "sales"
    Server.Execute("inc_salesNav.asp")
    Case Else
    Server.Execute("Error.asp")
    End Select

    End if
    %>

  • #3
    Senior Coder
    Join Date
    Jun 2002
    Location
    41° 8' 52" N -95° 53' 31" W
    Posts
    3,660
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Also, (“name”) isn't using a real "double quote" ( chr(34), as least as VBScript programs understand it?)... like ("name")... are you pasting this into Word or something before you post
    Last edited by whammy; 02-15-2003 at 01:49 AM.
    Former ASP Forum Moderator - I'm back!

    If you can teach yourself how to learn, you can learn anything. ;)

  • #4
    New Coder
    Join Date
    Jan 2003
    Location
    Peterborough, UK
    Posts
    39
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Well spotted Whammy!

    Is Server.Execute preferential to an include in situations like this, in purely performance terms?

  • #5
    Senior Coder
    Join Date
    Jun 2002
    Location
    41° 8' 52" N -95° 53' 31" W
    Posts
    3,660
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Good question, I've never used Server.Execute... I looked into it probably around a year ago, but promptly got interrupted with deadlines and stuff.

    I'm sure glenngv or perhaps RoySinclair may shed some light upon it... or a google search perhaps... to this day I still don't know what it does, lol.
    Last edited by whammy; 02-15-2003 at 01:50 AM.
    Former ASP Forum Moderator - I'm back!

    If you can teach yourself how to learn, you can learn anything. ;)

  • #6
    Senior Coder
    Join Date
    Jun 2002
    Location
    41° 8' 52" N -95° 53' 31" W
    Posts
    3,660
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Aha! Now I see...:

    http://msdn.microsoft.com/library/de...p/vbob9pid.asp

    I don't see a need for that, personally... but it could be helpful in some situations.
    Former ASP Forum Moderator - I'm back!

    If you can teach yourself how to learn, you can learn anything. ;)


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •