简体   繁体   中英

ASP Classic SSI or execute?

for a uni assignment I have to produce a web system, in ASP Classic 3.0. I'm having trouble with a few important bits.

The system has 4 different user types: Admin, Customer, Photographer and a general user who is not logged in.

I have the headers in an include file. If an admin logs in, they have a different header, as they can access secure areas etc, ultimately I need a different header for each of the 4 user types.

The admin's header is currently only displaying on the secured pages, because the include simply includes that file.

I can't use an if statement to check if the condition of the session variable "user_type" is true and then include their header: because of the way IIS deals with includes. It gets all 4 headers and outputs an error.

It appears that server.execute is the way to go, however, I am having trouble implementing it.

Any assistance or advice would be great.

Thanks, in advance

This ought to work

 If Session("user_type") = "Admin" Then 
    Server.Execute("adminheader.asp")
 ElseIf Session("user_type") = "Photographer" Then 
    Server.Execute("photographerheader.asp")
 ElseIf Session("user_type") = "Customer" Then 
    Server.Execute("customerheader.asp")
 Else
    Server.Execute("generalheader.asp")
 End If 

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM