|
 |
asptoday_discuss thread: Intermittent problem with display of ASP pages
Message #1 by Betty Gerstner <bettyg@h...> on Sat, 15 Jun 2002 13:32:16 -1000
|
|
Hi,
Do you know what would cause intermittent problems with the display of
pages on an ASP 3.0 server? The page just keeps trying to load, but never
does, even after 15-30 minutes. The problem does not happen all the time
and, when it does, it may happen with any one of several ASP pages on the
server. Each time I report the problem to our host server, they restart
the ASP server and it stops happening for about a week or two and then it
begins again.
There are no error messages. Most of the pages where this occurs have a
case statement with a response.redirect statement, redirecting to another
page, based on criteria sent to the page. But, once it starts happening,
it can happen to any of the ASP pages on the server.
The asp pages were originally written for ASP 2.0, but they are running on
an ASP 3.0 server. I have put the "response.buffer = True" statement at
the beginning of the asp file. Below is the full code from one of the
files with which I am experiencing intermittent problems:
<%@ LANGUAGE="VBSCRIPT" %>
<% Option Explicit %>
<% Response.Buffer = True %>
<%
' Filename = MemSelect.asp
' This file is called by Memlist.asp
' Based on the option selected on the Memlist.asp page
' this file redirects to the appropriate page:
' optView = View Selected Member Record
' Redirect to MemView.asp
' optEdit = Edit Selected Member Record
' Redirect to Memedit.asp
' optRenewal = Add Renewal for Selected Member Record
' Redirect to MemRenew.asp
' optEditRenewal = Edit a Renewal for Selected Member Record
' Redirect to MemRenew.asp
Dim strMemberNo, lngMemberNo
Dim strAnnualDate, strOption
%>
<!--#include file="adovbs.inc" -->
<%
strOption = Request.Form("radiobutton")
strMemberNo = Request.Form("optMembers")
If IsNumeric(strMemberNo) then
lngMemberNo = Clng(strMemberNo)
Else
lngMemberNo = 0
End If
Select Case strOption
Case "optView" 'View member record
Response.Clear
Response.redirect "MemView.asp?MemNo=" & lngMemberNo & ""
Case "optEdit" 'Edit Member information
Response.Clear
Response.redirect "MemEdit.asp?MemNo=" & lngMemberNo & ""
Case "optRenewal" 'Add renewal record for member
Response.Clear
Response.redirect "MemRenew.asp?MemNo=" & lngMemberNo & ""
Case "optEditRenewal" 'Edit an existing renewal record
strAnnualDate = Request.Form("txtAnnualDate")
If strAnnualDate > "" then
If IsDate(strAnnualDate) then
Response.Clear
Response.redirect "MemEditRenew.asp?MemNo=" & lngMemberNo &
"&MemDate=" & strAnnualDate & ""
else
Response.Write("The Member Annual Renewal Date is not a valid date.<br>")
Response.Write("Click on the BACK button to return to the Search
Listing.<br>")
Response.Write(" OR<br>")
Response.Write("Click <a href='MemSrch.asp'>HERE</a> to Return to
Search Page.<br>")
End If
Else
Response.Write("Must Have a Member Date to edit an existing renewal.<br>")
Response.Write("Click on the BACK button to return to the Search
Listing.<br>")
Response.Write(" OR<br>")
Response.Write("Click <a href='MemSrch.asp'>HERE</a> to Return to Search
Page.<br>")
End If
End Select
%>
What makes this really hard to trouble-shoot is that there are no error
messages and it doesn't happen all the time to the same pages. I have
bought the Wrox Professional Active Server Pages 3.0 book and I'm trying to
go through it to determine if something in my 2.0 code may be causing
problems on the 3.0 server, but any help I can get will be much appreciated.
TIA,
Betty Gerstner
bettyg@h...
Message #2 by Betty Gerstner <bettyg@h...> on Tue, 18 Jun 2002 20:18:18 -1000
|
|
--=======7A011153=======
Content-Type: text/plain; x-avg-checked=avg-ok-233517F6; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 8bit
At 09:15 AM 6/17/02 -0700, R. Sanchez wrote:
>1. Intermittent problem with display of ASP pages
>
>Hi, the code that you have it's fine, it's my own point of view, but i
>have a question : which DataBase you use? SQL Server?, Access?, because
>the problem may be the connection with the DB. Only when the problem occur
>don't load the page?, don't send it other error?.
Thanks for your comments on my code.
I use an Access database on the server. The thing is, many of the ASP
pages that are hanging do not even have any database access code, but they
still don't load and no error is displayed. We just had the problem occur
again (it recurs every few weeks after being corrected by our host
restarting the server) and it has again stopped happening after our host
cleared and restarted the ASP services on our web site. But I expect it to
start happening again in the next week or so, as it has been doing so since
February.
Below is a sample of the database connection code on one of the pages that
does have database access code. It is is a separate function that is
passed two variables to verify the users username and password with records
in the Members Table of the database:
<%
Function CheckUsers(strUserN, strPassW)
Dim oRs, strSql
CheckUsers = False 'default return value of function
strSql = "Select Members.MemberName, Members.UserName, "
strSql = strSql & "Members.Password, Members.UserLevel "
strSql = strSql & "from Members "
strSql = strSql & "WHERE (UCase(Members.Username) = "
strSql = strSql & "'" & UCase(strUserN) & "') "
strSql = strSql & "and (UCase(Members.Password) "
strSql = strSql & "= '" & UCase(strPassW) & "')"
If Not strSql = "" then
Set oRs = Server.CreateObject("ADODB.Recordset")
If err.number > 0 Then
response.write("Error connecting to the database for the
Users Table. Error No. " & err.number & " " & err.description & "<br>")
response.flush
response.end
End If
oRs.Open strSql, "DSN=ppioco.pmembers", 3, 1
If err.number > 0 Then
response.write("Error opening the database for the Users
Table. Error No. " & err.number & " " & err.description & "<br>")
response.flush
response.end
End If
If Not oRs.EOF and Not oRs.BOF then
oRs.MoveFirst
strRealName = oRs.Fields("MemberName")
Session("RealName") = oRs.Fields("MemberName")
Session("UserLevel") = oRs.Fields("UserLevel")
lngUserlevel = oRs.Fields("UserLevel")
oRs.Close
Set oRs = Nothing
CheckUsers = True
End If
End If
End Function
%>
Thanks.
Betty Gerstner
bettyg@h...
--=======7A011153=======
Content-Type: text/plain; charset=us-ascii; x-avg=cert; x-avg-checked=avg-ok-233517F6
Content-Disposition: inline
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.371 / Virus Database: 206 - Release Date: 6/13/02
--=======7A011153=======--
Message #3 by "Zhang, Yongrong" <Yongrong.Zhang@R...> on Wed, 19 Jun 2002 08:50:51 -0400
|
|
--- do not use 'flush' several times and within the function
here is the re-written code, hope it works, enjoy the day
'----------------function checkusers --------------
function checkusers(usrnm,usrpwd)
on error resume next
if not (len(usrnm)>0 and len(usrpwd)>0) then
checkusers=false
exit fucntion
end if
sql="Select Members.MemberName, Members.UserName, "
sql = sql & "Members.Password, Members.UserLevel "
sql = sql & "from Members "
sql = sql & "WHERE (UCase(Members.Username) = "
sql = sql & "'" & UCase(strUserN) & "') "
sql= sql & "and (UCase(Members.Password) "
sql = sql & "= '" & UCase(strPassW) & "')"
' better to put db connection and recordset as global
variable
set conn=server.createobject("adodb.connection")
conn.open("DSN=ppioco.pmembers")
set rs=server.createobject("adodb.recordset")
rs.open sql,conn,3,1
rtn=true
if err<>0 or rs.eof then rtn=false
checkusers=rtn
end function
'-----------------------------------------------------
-----Original Message-----
From: Betty Gerstner [mailto:bettyg@h...]
Sent: Wednesday, June 19, 2002 2:18 AM
To: ASPToday Discuss
Subject: [asptoday_discuss] Re:Intermittent problem with display of ASP
pages
At 09:15 AM 6/17/02 -0700, R. Sanchez wrote:
>1. Intermittent problem with display of ASP pages
>
>Hi, the code that you have it's fine, it's my own point of view, but i
>have a question : which DataBase you use? SQL Server?, Access?, because
>the problem may be the connection with the DB. Only when the problem occur
>don't load the page?, don't send it other error?.
Thanks for your comments on my code.
I use an Access database on the server. The thing is, many of the ASP
pages that are hanging do not even have any database access code, but they
still don't load and no error is displayed. We just had the problem occur
again (it recurs every few weeks after being corrected by our host
restarting the server) and it has again stopped happening after our host
cleared and restarted the ASP services on our web site. But I expect it to
start happening again in the next week or so, as it has been doing so since
February.
Below is a sample of the database connection code on one of the pages that
does have database access code. It is is a separate function that is
passed two variables to verify the users username and password with records
in the Members Table of the database:
<%
Function CheckUsers(strUserN, strPassW)
Dim oRs, strSql
CheckUsers = False 'default return value of function
strSql = "Select Members.MemberName, Members.UserName, "
strSql = strSql & "Members.Password, Members.UserLevel "
strSql = strSql & "from Members "
strSql = strSql & "WHERE (UCase(Members.Username) = "
strSql = strSql & "'" & UCase(strUserN) & "') "
strSql = strSql & "and (UCase(Members.Password) "
strSql = strSql & "= '" & UCase(strPassW) & "')"
If Not strSql = "" then
Set oRs = Server.CreateObject("ADODB.Recordset")
If err.number > 0 Then
response.write("Error connecting to the database for the
Users Table. Error No. " & err.number & " " & err.description & "<br>")
response.flush
response.end
End If
oRs.Open strSql, "DSN=ppioco.pmembers", 3, 1
If err.number > 0 Then
response.write("Error opening the database for the Users
Table. Error No. " & err.number & " " & err.description & "<br>")
response.flush
response.end
End If
If Not oRs.EOF and Not oRs.BOF then
oRs.MoveFirst
strRealName = oRs.Fields("MemberName")
Session("RealName") = oRs.Fields("MemberName")
Session("UserLevel") = oRs.Fields("UserLevel")
lngUserlevel = oRs.Fields("UserLevel")
oRs.Close
Set oRs = Nothing
CheckUsers = True
End If
End If
End Function
%>
Thanks.
Betty Gerstner
bettyg@h...
======== V =========
This email message may contain legally privileged and/or confidential
information. If you are not the intended recipient(s), or the employee or
agent responsible for the delivery of this message to the intended
recipient(s), you are hereby notified that any disclosure, copying,
distribution, or use of this email message is prohibited. If you have
received this message in error, please notify the sender immediately by
e-mail and delete this email message from your computer. Thank you.
|
|
 |