intermittent asp error
am 15.01.2008 13:54:00 von ViknesDear all,
I've an asp page running on IIS6.0 with Win2003. I got this error returned
from the asp while doing file upload (see sample code attached below).
Error Details:
Error number: (-2147467259)
Error Description: 007~ASP 0101 Unexpected error The function returned |.
Error Source: Request Object
I assume that I've a proper value set for "AspMaxRequestEntityAllowed" and
"MaxClientRequestBuffer"
Any idea if any fix is required from the coding perspective? it seems to be
related by the asp: Request.BinaryRead method, from what i could find on the
internet.
The recommendation that I found is the following from
"http://support.softartisans.com/kbview_279.aspx", Service pack3 for windows
2000 may resolve the problem. Please download and apply the latest service
pack available from MS for windows but it related to a different product.
KIndly let us know if this is the case.
Thanks
Viknes
------------------------------------------------------------ ------------------------------------
Sample Code:
Private Function SaveUploadFile(ByVal strFilename As String)
On Error GoTo SaveUploadFileErr
Dim strUploadPath As String
Dim oFso As Scripting.FileSystemObject
Dim oStream As ADODB.Stream
Dim sFilePath As String
Dim FormSize, FormData
strUploadPath = "\HQS\"
Set oFso = New Scripting.FileSystemObject
If oFso.FolderExists(objServer.MapPath(strUploadPath)) = False Then
If MkDirs(objServer.MapPath(strUploadPath)) Then
WriteSuccess strUploadPath & " successfully created!"
Else
objResponse.Write "failed to create " & strUploadPath
objResponse.End
Set oFso = Nothing
Exit Function
End If
End If
Set oFso = Nothing
WriteSuccess strFilename & " ready to save..."
Set oStream = New ADODB.Stream
sFilePath = objServer.MapPath(strUploadPath & strFilename)
FormSize = objRequest.TotalBytes
FormData = objRequest.BinaryRead(FormSize)
With oStream
.Mode = adModeReadWrite
.Type = adTypeBinary
.Open
.Position = 0
.Write FormData
.SaveToFile sFilePath, adSaveCreateNotExist
End With
Set oStream = Nothing
Set oFso = New Scripting.FileSystemObject
If FileLen(sFilePath) <> FormSize Then
objResponse.Write "HOST PROCESSING FAILED"
objResponse.End
Set oFso = Nothing
Exit Function
Else
objResponse.Write "SUCCESSFULLY RETRIEVED"
End If
Set oFso = Nothing
WriteSuccess strFilename & " successfully saved..."
Exit Function
SaveUploadFileErr:
objResponse.Write "Err:" & Err.Number & "/Desc:" & Err.Description
Set oFso = Nothing
Set oStream = Nothing
End Function
------------------------------------------------------------ ----------------------------------