I have a SELECT CASE statement that I am trying to get working. Essentially i want to query for specific group numbers in our DBase and show the respective information with an include file. I am getting an error, but am unable to diagnose what is actually causing the error...
Is my statement not structured correctly?
<%
select case session("memGroup")
case "123456789","987654321"
'Show forms for Company ABC
%>
<!--#include virtual="/members/_includes/formsABC.asp"-->
<%
case "333333333","22222222","111111111"
'Show forms for Company DEF
%>
<!--#include virtual="/members/_includes/formsDEF.asp"-->
<%
end select
%>
<开发者_JAVA技巧!--then show forms for everyone else-->
<!--#include virtual="/members/_includes/formsEveryoneElse.asp"-->
ASP will process all the includes first, so this is not the best way of doing this as includes are expensive, I would do something like this instead:
<%
Select Case Session.Contents("memGroup")
Case "123456789", "987654321":
'Show forms for Company ABC
Server.Execute("/members/_includes/formsABC.asp")
Case "333333333", "22222222", "111111111":
'Show forms for Company DEF
Server.Execute("/members/_includes/formsDEF.asp")
Case Else:
Server.Execute("/members/_includes/formsEveryoneElse.asp")
End Select
%>
http://msdn.microsoft.com/en-us/library/ms525849(v=vs.90).aspx https://web.archive.org/web/20211020134119/https://www.4guysfromrolla.com/webtech/022504-1.shtml
As a side note if the web server is running IIS 7 or greater you will need to change web.config to see ASP error messages:
<configuration>
<system.webServer>
<asp scriptErrorSentToBrowser="true"/>
<httpErrors errorMode="Detailed"/>
</system.webServer>
</configuration>
Also you will need to turn off "Show Friendly HTTP Error Messages" in Internet Explorer or use another browser to view the error.
http://classicasp.aspfaq.com/general/why-do-i-get-a-500-internal-server-error-for-all-asp-errors.html
精彩评论