...

View Full Version : ASP Question



phillip_ewing
02-14-2003, 08:01 PM
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.



<%
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.

raven
02-15-2003, 12:20 AM
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
%>

whammy
02-15-2003, 01:24 AM
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 :confused:

raven
02-15-2003, 01:46 AM
Well spotted Whammy!

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

whammy
02-15-2003, 01:48 AM
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.

whammy
02-15-2003, 01:53 AM
Aha! Now I see...:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/iisref/html/psdk/asp/vbob9pid.asp

I don't see a need for that, personally... but it could be helpful in some situations.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum