I'm getting speratic script timeout errors when people run the following
code. Maybe some could help me figure out why. The loading text files
average in size from 100k to 2.5 meg.
option explicit
Dim county, view, CountyFSO, CountyViewFile,CountyCurrentLine, msg, txt,
sDisplayFile
county = Request.QueryString("county")
view = Request.QueryString("radio_button")
Public Function root()
root = Request.ServerVariables( "Appl_Physical_Path" )
End Function
Public Function rfile( fVar )
Set CountyFSO = Server.CreateObject( "Scripting.FileSystemObject" )
If CountyFSO.FileExists( fVar ) Then
Set Txt = CountyFSO.OpenTextFile( fVar, 1 )
msg = Txt.ReadAll
Txt.Close
Set Txt = nothing
ElseIf Not CountyFSO.FileExists( fVar ) Then
msg = "FAIL: File " & fvar & " does not exist."
End If
Set CountyFSO = Nothing
rfile = msg
End Function
If county <> "" Then
if view="view" then
if county <> "1000_FED_SUBSIDY_SUMMARY_IRN.TXT" then
'experiment with different fonts and broswers (true type
fonts may not display right)
DIM bc
SET bc = Server.CreateObject("MSWC.BrowserType")
IF inStr(1,ucase(bc.browser),"NETSCAPE",1) > 0 or
inStr(1,ucase(bc.browser),"DEFAULT",1) > 0 THEN
Response.Write "<font><span style='font-family:
Courier New; font-size: 7pt'>"
Else
Response.Write "<font face='courier new'
size='1'><span>"
End If
sDisplayFile = rfile(root() & "/subsidy-report/" & county)
If msg <> "FAIL: File does not exist." Then
'attempt to compensate for tab, spaces, line returns
sDisplayFile = Replace(sDisplayFile, CHR(13),
"<br>")
sDisplayFile = Replace(sDisplayFile, " ", " ")
End If
'display the file
Response.write sDisplayFile
Response.Write("</span></font>")
SET bc = nothing
Response.Flush
Response.End
else
Response.Write("This file is too large to display, please
download the file from this link:<br>")
%><a href="<%=county %>"><%=county %></a><%
End If
end if