简体   繁体   English

ASP Classic SSI还是执行?

[英]ASP Classic SSI or execute?

for a uni assignment I have to produce a web system, in ASP Classic 3.0. 对于单作业,我必须使用ASP Classic 3.0生产一个Web系统。 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. 该系统具有4种不同的用户类型:管理员,客户,摄影师和未登录的一般用户。

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. 如果管理员登录,他们将具有不同的标题,因为他们可以访问安全区域等,最终我需要为4种用户类型中的每一个使用不同的标题。

The admin's header is currently only displaying on the secured pages, because the include simply includes that file. 管理员的标头目前仅显示在受保护的页面上,因为include仅包含该文件。

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. 我不能使用if语句来检查会话变量“ user_type”的条件是否为true,然后包括其标头:因为IIS处理include的方式。 It gets all 4 headers and outputs an error. 它获取所有4个标头并输出错误。

It appears that server.execute is the way to go, however, I am having trouble implementing it. 似乎server.execute是要走的路,但是,我在实现它时遇到了麻烦。

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 

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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