Click to See Complete Forum and Search --> : HTTP 500 - Internal Server Error/Doesn't Make Sense


kwilliams
11-21-2003, 09:01 AM
Hi,

I have a page that uses VBScript to email logged in users, and it works great. But when users

have "Show Friendly HTTP Error Messages checked at Tools>Internet Options>Advanced Tab, they

get a "HTTP 500 - Internal Server Error" message. But when it's unchecked, the page works fine.

Can anyone see something obvious in why this is happening? I've included the code for this page

at the bottom of my post. Any & all help is appreciated.

KWilliams


PAGE'S CODE:

<%@LANGUAGE="JAVASCRIPT"%>
<!--#include file="Connections/strConn.asp" -->
<script runat=server language="vbscript" src="ScriptLibrary/date_validation.vbs"></script>
<%

if(String(Session("App_Date")) != "undefined"){ cmdAppDate__varApp_Date =

String(Session("App_Date"));}

if(String(Session("MM_Username")) != "undefined"){ cmdAppDate__varApp_ID3 =

String(Session("MM_Username"));}

%>
<%
if (Session("MM_recordId") != null) { }
else {Response.Redirect("noaccess.asp")}
%>
<%
var rsNewApp1__MMColParam = "Seqno";
if(String(Request.QueryString("id")) != "undefined") {
rsNewApp1__MMColParam = String(Request.QueryString("id"));
}
%>
<%
var rsNewApp1__varApp_ID1 = "%";
if(String(Session("MM_Username")) != "undefined") {
rsNewApp1__varApp_ID1 = String(Session("MM_Username"));
}
%>
<%
var rsNewApp1__varPassword = "%";
if(String(Session("MM_Password")) != "undefined") {
rsNewApp1__varPassword = String(Session("MM_Password"));
}
%>
<%
var rsNewApp1 = Server.CreateObject("ADODB.Recordset");
rsNewApp1.ActiveConnection = MM_strConn_STRING;
rsNewApp1.Source = "SELECT * FROM dbo.Employment_App WHERE App_ID LIKE '"+

rsNewApp1__varApp_ID1.replace(/'/g, "''") + "' AND Password LIKE '"+

rsNewApp1__varPassword.replace(/'/g, "''") + "' AND Seqno = "+

rsNewApp1__MMColParam.replace(/'/g, "''") + "";
rsNewApp1.CursorType = 0;
rsNewApp1.CursorLocation = 2;
rsNewApp1.LockType = 3;
rsNewApp1.Open();
var rsNewApp1_numRows = 0;
%>
<%
Session("MM_Username") = rsNewApp1.Fields.Item("App_ID").Value;
Session("MM_recordId") = rsNewApp1.Fields.Item("Seqno").Value;
Session("Last_Name") = rsNewApp1.Fields.Item("Last_Name").Value;
Session("First_Name") = rsNewApp1.Fields.Item("First_Name").Value;
Session("MM_Email") = rsNewApp1.Fields.Item("Email").Value;
Session("Last_Update_Date") = rsNewApp1.Fields.Item("Last_Update_Date").Value;
Session("Creation_Date") = rsNewApp1.Fields.Item("Creation_Date").Value;
Session("MM_Resume") = rsNewApp1.Fields.Item("Resume_Attach").Value;
%>
<%
var rsNewApp2__varApp_ID2 = "%";
if(String(Session("MM_Username")) != "undefined") {
rsNewApp2__varApp_ID2 = String(Session("MM_Username"));
}
%>
<%
var rsNewApp2 = Server.CreateObject("ADODB.Recordset");
rsNewApp2.ActiveConnection = MM_strConn_STRING;
rsNewApp2.Source = "SELECT * FROM dbo.Employ_Jobs WHERE App_ID LIKE '"+

rsNewApp2__varApp_ID2.replace(/'/g, "''") + "'";
rsNewApp2.CursorType = 0;
rsNewApp2.CursorLocation = 2;
rsNewApp2.LockType = 3;
rsNewApp2.Open();
var rsNewApp2_numRows = 0;
%>
<%

var cmdAppDate = Server.CreateObject("ADODB.Command");
cmdAppDate.ActiveConnection = MM_strConn_STRING;
cmdAppDate.CommandText = "UPDATE dbo.Employment_App SET Application_Date = '"+

cmdAppDate__varApp_Date.replace(/'/g, "''") + "', Last_Update_Date = '"+

cmdAppDate__varApp_Date.replace(/'/g, "''") + "' WHERE App_ID = '"+

cmdAppDate__varApp_ID3.replace(/'/g, "''") + "' ";
cmdAppDate.CommandType = 1;
cmdAppDate.CommandTimeout = 0;
cmdAppDate.Prepared = true;
cmdAppDate.Execute();

%>
<SCRIPT LANGUAGE="VBSCRIPT" RUNAT="SERVER">
Response.Buffer = True
Const cdoSendUsingPickup = 1
Const strPickup = "c:\Program Files\Exchsrvr\mailroot\vsi 1\Pickup"

Set objSendMail = CreateObject("CDO.Message")
Set iConf = objSendMail.Configuration

With iConf.Fields
.item("http://schemas.microsoft.com/cdo/configuration/sendusing") = cdoSendUsingPickup
.item("http://schemas.microsoft.com/cdo/configuration/smtpserverpickupdirectory") = strPickup
.Update
End With

With objSendMail
.To = "pmoore@douglas-county.com"
.CC = "kwilliams@douglas-county.com"
.From = Session("MM_Email")
.Subject = "New Application"
.TextBody = "APPLICANT'S INFORMATION" & vbcrlf & "First Name: " & Session("First_Name") &

vbcrlf & "Last Name: " & Session("Last_Name") & vbcrlf & "App ID: " & Session("MM_Username") &

vbcrlf & vbcrlf & "To view & print a copy of this new application, click the link below:" &

vbcrlf & vbcrlf & "http://www.douglas-county.com/Employment/redirectapp.asp?id=" &

Session("MM_recordId") & vbcrlf & vbcrlf & "To view & print a copy of their resume, click the

link below:" & vbcrlf & vbcrlf &

"http://www.douglas-county.com/Employment/redirectresume.asp?id=" & Session("MM_recordId") &

vbcrlf & vbcrlf & "(NOTE: If the link above only says www.douglas-county.com, then the

applicant did not attach their resume to this application.)"
.Send
End With

Set objSendMail = Nothing
</SCRIPT>
<meta http-equiv="refresh" content="0;URL=thankyou.asp">
<%
rsNewApp1.Close();
%>
<%
rsNewApp2.Close();
%>

DaiWelsh
11-21-2003, 09:40 AM
Have you tried taking out the redirect? My guess is when you do you will see an error message that is being generated by the script, but which your redirect is immediately whipping out of your sight normally?

HTH,

Dai

kwilliams
11-21-2003, 09:43 AM
I'll take it out, and replace it with an ASP redirect. I'll let you know what happens. Thanks for the suggestion.

KWilliams

DaiWelsh
11-21-2003, 09:49 AM
That might be better yes, but really I just meant comment it out temporarily and try the page yourself to see what you see ;)

kwilliams
11-21-2003, 10:16 AM
DaiWelsh,

That was the first thing I tried, and I had the same experience. When I checked "Show Friendly HTTP Error Messages", I received the "HTTP 500 - Internal Server Error" message. But when I unchecked it again, the page worked fine.

That's why it's so confusing. My NA has no idea why this would be happening, and I've never seen this happen before. Any other suggestions?

KWilliams

DaiWelsh
11-21-2003, 10:33 AM
The only other thing I can thing is that it is because you are not sending valid HTML back to the browser. This could be fixed by using response.redirect or by adding html tags e.g.

<html>
<head>
<meta http-equiv="refresh" content="0;URL=thankyou.asp">
</head>
<body>
</body>
</html>

While I am no standards expert, I think the meta tag is probably not valid all on its own?

Do you have a URL for me to try it myself?

kwilliams
11-21-2003, 10:44 AM
...but I changed it so that there's no HTML on the page, and it's completely written in ASP by changing the refresh meta-tag to:
<%Response.Redirect("thankyou.asp")%>

and when I tried this page again by checking & unchecking that box, it had the exact same result. It's not the redirect that's causing the error. It's the actual page itself, because that's where it stops with the error message.

You can test this out by going to: http://www.douglas-county.com/Employment/appmain.asp

Login using UN: AnotherTest & PW: AnotherTest

Then scroll down on that page, and click the "Submit New Application" button. If you have that "Show HTTP Friendly Error Messages" thing unchecked, it will work. But if you check that box, you will get that "HTTP 500 - Internal Server Error" message. Let me know what you find.

KWilliams

DaiWelsh
11-21-2003, 11:12 AM
Hmm, that is odd, I cannot see a good reason for that. :( Will cogitate and come back to you if anything occurs to me later.

kwilliams
11-21-2003, 11:14 AM
Ok, thanks DaiWelsh. I really appreciate your help:)

KWillliams