MapNetworkDrive: Extremely Poor Performance When Writing to Path

B

Billy

Hi All,

I'm attempting to use the MapNetworkDrive <snipped> below from entire
code below with very poor performance results.

Basically, I have very small 73kb text files that are rewritten daily
to a network share using the MapNetworkDrive command to connect to the
valid \\servername\share path.

After successfully connecting the drive in the ASP code, the text file
write process begins and takes more than 15 minutes to write the first
file when the asp page is executed. The process finally times out
since I have set the Server.ScriptTimeOut = 900 for testing purposes
which limits the asp page execution to 15 minutes. In that entire
time, the first file is viewable on the network share but only
partially completed. The additioanl files never complete.

I have done some troubleshooting by manually mapping the share
(outside of the ASP code) using Windows Explorer and copied the same
file that is being created in the routine from the IIS server to the
mapped drive - results are miliseconds to copy - excellent performance
this way.

Any idea of what would cause this performance hit from the looks of my
code? The server is IIS W2K3 and latest version of IIS and updates is
installed. We run many other ASP processes on the server successfully.

'<snip>

Set objNetwork = CreateObject("WScript.Network")
'objNetwork.RemoveNetworkDrive "M:"
strDriveLetter = "M:"
strRemotePath = "\\nad2divdb1\E_PT"
strUser = "Username"
strPassword = "Password"
strProfile = "False" ' means do not store in profile leave as false.
objNetwork.MapNetworkDrive strDriveLetter, strRemotePath, strProfile,
strUser, strPassword
' WScript.Quit

'<end snip>

Here is the entire page of code........

<html>

<head>
<title>Package Tracking Results - Client Feed</title>
</head>

<body>

<!-- #INCLUDE VIRTUAL="/nsceast/miscellaneous/adovbs.inc" --> <!--
Use "Virtual" rather than "File" for Virtual Path -->

<%
' set timeout for longer processing (default is 90 seconds)
Server.ScriptTimeOut = 900 ' In seconds - 300s = 5m

' define variables
dim oConn ' ADO Connection
dim oRSc ' ADO Recordset - Courier table
dim cfedexSQLstr ' SQL string - Courier table - FedEx
extraction
dim cupsSQLstr ' SQL string - Courier table - UPS
extraction
dim cdhlSQLstr ' SQL string - Courier table - DHL
extraction
dim oRSn ' ADO Recordset - NAN table
dim nSQLstr ' SQL string - NAN table
dim objFSO ' FSO Connection
dim objTextFile ' Text File
Dim i, j, tmp ' variables used for the Text File
Build process
Dim strMonth, strDay, strYear ' variables from user selection of
month/day/year
dim strDate ' variable to store complete date
dim cSwitch ' switch for Courier field(s) to
prevent extra comma when two spaces between fields occur
dim cSubSwitch ' subroutine loop switch (used to
determine clear of oRSc recordset)
dim objNetwork ' WScript drive access Connection
dim strRemotePath, strProfile, strUser, strPassword ' Additional
WScript variables

' set and open ADO connection
set oConn=Server.CreateObject("ADODB.connection")
oConn.Open "DRIVER={Microsoft Access Driver (*.mdb)};DBQ=" & "c:/
Database/QaTracking/QaTracking.mdb" & ";"

' set and define FSO connection and text file object location
Set objFSO = CreateObject("Scripting.FileSystemObject")

Set objNetwork = CreateObject("WScript.Network")
'objNetwork.RemoveNetworkDrive "M:"
strDriveLetter = "M:"
strRemotePath = "\\nad2divdb1\E_PT"
strUser = "Username"
strPassword = "Password"
strProfile = "False" ' means do not store in profile leave as false.
objNetwork.MapNetworkDrive strDriveLetter, strRemotePath, strProfile,
strUser, strPassword
'WScript.Quit

' Store User Month/Day/Year
strMonth = Request.QueryString("Month")
strDay = Request.QueryString("Day")
strYear = Request.QueryString("Year")
strDate = strMonth & "/" & strDay & "/" & strYear

' SQL strings for Courier and NAN tables
cfedexSQLstr = "SELECT * FROM Courier WHERE Courier.Courier = 'Fedex'
AND Courier.Date = #" & strDate & "#"
cupsSQLstr = "SELECT * FROM Courier WHERE Courier.Courier = 'UPS' AND
Courier.Date = #" & strDate & "#"
cdhlSQLstr = "SELECT * FROM Courier WHERE Courier.Courier = 'Airborne'
AND Courier.Date = #" & strDate & "#"
nSQLstr = "SELECT * FROM NAN"

' Initial Switch values
'cSwitch = "Off"
cSubSwitch = "Off"

'*******************************
'//// BUILD FEDEX TEXT FILE ////
'*******************************
Response.ContentType = "text/plain"
'cSwitch = "Off"
'------------------------------
'//// OPEN FEDEX RECORDSET ////
'------------------------------
set oRSc=Server.CreateObject("ADODB.Recordset")
oRSc.Open cfedexSQLstr, oConn
'------------------------------
'//// OPEN FEDEX TEXT FILE ////
'------------------------------
'Set objTextFile = objFSO.CreateTextFile(Server.MapPath("textfile.txt",
2))
'Response.Write (Server.MapPath("textfile.txt") & "<br />")
Set objTextFile = objFSO.OpenTextFile("M:\FED000.txt",2)
'--------------------------------------------
'//// CALL SUBROUTINE TO BUILD TEXT FILE ////
'--------------------------------------------
Call TextFileBuildLoop

'*****************************
'//// BUILD UPS TEXT FILE ////
'*****************************
Response.ContentType = "text/plain"
'cSwitch = "Off"
'----------------------------
'//// OPEN UPS RECORDSET ////
'----------------------------
set oRSc=Server.CreateObject("ADODB.Recordset")
oRSc.Open cupsSQLstr, oConn
'----------------------------
'//// OPEN UPS TEXT FILE ////
'----------------------------
'Set objTextFile =
objFSO.CreateTextFile(Server.MapPath("textfile.txt"))
'Response.Write (Server.MapPath("textfile.txt") & "<br />")
Set objTextFile = objFSO.OpenTextFile("C:\UPS000.txt",2)
'--------------------------------------------
'//// CALL SUBROUTINE TO BUILD TEXT FILE ////
'--------------------------------------------
Call TextFileBuildLoop

'*****************************
'//// BUILD DHL TEXT FILE ////
'*****************************
Response.ContentType = "text/plain"
'cSwitch = "Off"
'----------------------------
'//// OPEN DHL RECORDSET ////
'----------------------------
set oRSc=Server.CreateObject("ADODB.Recordset")
oRSc.Open cdhlSQLstr, oConn
'----------------------------
'//// OPEN DHL TEXT FILE ////
'----------------------------
'Set objTextFile =
objFSO.CreateTextFile(Server.MapPath("textfile.txt"))
'Response.Write (Server.MapPath("textfile.txt") & "<br />")
Set objTextFile = objFSO.OpenTextFile("C:\DHL000.txt",2)
'--------------------------------------------
'//// CALL SUBROUTINE TO BUILD TEXT FILE ////
'--------------------------------------------
cSubSwitch = "On"
Call TextFileBuildLoop

'*******************
'//// SUBROUTINE////
'*******************
SUB TextFileBuildLoop
'---------------------------------
'//// WRITE TEXT TO TEXT FILE ////
'---------------------------------
'objTextFile.WriteLine "This text is in the file ""textfile.txt""!"
'------------------------------------------------------
'//// BEGIN TEXT FILE BUILDING - LOOP THROUGH ROWS ////
'------------------------------------------------------
If Not oRSc.EOF Then
'-------------------------------------------------------------
'//// THIS PART PRODUCES THE FIRST TOP ROW OF FIELD NAMES ////
'-------------------------------------------------------------
' For i = 1 To oRSc.Fields.Count
' objTextFile.Write oRSc.Fields(i-1).Name
' If i < oRSc.Fields.Count Then
' objTextFile.Write " "
' End If
' Next
' objTextFile.WriteLine
' --------------------- // END // ----------------------------
While Not oRSc.EOF
For i = 1 To oRSc.Fields.Count
'------------------------------------------------------
'//// THIS PART ADDS QUOTES AROUND THE FIELD VALUE ////
'------------------------------------------------------
If oRSc.Fields(i-1) <> "" Then
tmp = oRSc.Fields(i-1)
' If TypeName(tmp) = "String" Then
' objTextFile.Write """" &_
'Replace(oRSc.Fields(i-1),vbCrLf,"""") & ""
' Else
'---------------------- // END // ---------------------
objTextFile.Write oRSc.Fields(i-1)
' End If
End If
' writes the space between fields
If i < oRSc.Fields.Count Then
' If cSwitch = "Off" Then
objTextFile.Write " "
' End If
End If
' If oRSc.Fields(i-1).Name = "Track" Then
' cSwitch = "On"
' Else
' cSwitch = "Off"
' End If
' loop through fields / stay on same record
Next
' go to next line in text file / move to next record
objTextFile.WriteLine
oRSc.MoveNext
Wend
End If
Set objTextFile = Nothing
If cSubSwitch = "Off" Then
Set oRSc = Nothing
End If
END SUB

'*****************************
'//// BUILD NAN TEXT FILE ////
'*****************************
Response.ContentType = "text/plain"
'----------------------------
'//// OPEN NAN RECORDSET ////
'----------------------------
set oRSn=Server.CreateObject("ADODB.Recordset")
oRSn.Open nSQLstr, oConn
'----------------------------
'//// OPEN NAN TEXT FILE ////
'----------------------------
'Set objTextFile =
objFSO.CreateTextFile(Server.MapPath("textfile.txt"))
'Response.Write (Server.MapPath("textfile.txt") & "<br />")
Set objTextFile = objFSO.OpenTextFile("C:\NAN000.txt",2)
'---------------------------------
'//// WRITE TEXT TO TEXT FILE ////
'---------------------------------
'objTextFile.WriteLine "This text is in the file ""textfile.txt""!"
'------------------------------------------------------
'//// BEGIN TEXT FILE BUILDING - LOOP THROUGH ROWS ////
'------------------------------------------------------
If Not oRSn.EOF Then
'-------------------------------------------------------------
'//// THIS PART PRODUCES THE FIRST TOP ROW OF FIELD NAMES ////
'-------------------------------------------------------------
' For i = 1 To oRSn.Fields.Count
' objTextFile.Write oRSn.Fields(i-1).Name
' If i < oRSn.Fields.Count Then
' objTextFile.Write " "
' End If
' Next
' objTextFile.WriteLine
' --------------------- // END // ----------------------------
While Not oRSn.EOF
For i = 1 To oRSn.Fields.Count
If oRSn.Fields(i-1) <> "" Then
tmp = oRSn.Fields(i-1)
'------------------------------------------------------
'//// THIS PART ADDS QUOTES AROUND THE FIELD VALUE ////
'------------------------------------------------------
' If TypeName(tmp) = "String" Then
' objTextFile.Write """" &_
'Replace(oRSn.Fields(i-1),vbCrLf,"""") & ""
' Else
'---------------------- // END // ---------------------
objTextFile.Write oRSn.Fields(i-1)
' End If
End If
If i < oRSn.Fields.Count Then
objTextFile.Write " "
End If
Next
objTextFile.WriteLine
oRSn.MoveNext
Wend
End If

Dim clientIP
clientIP = Request.ServerVariables("REMOTE_ADDR")

' define variable
dim objCDOMail
' create mail object
Set objCDOMail = Server.CreateObject("CDONTS.NewMail")
' compose message
objCDOMail.From = "CLI2-TRAINING <[email protected]>" 'this format
authors the e-mail as a name of your choice
objCDOMail.To = "(e-mail address removed);"
objCDOMail.Cc = ""
objCDOMail.Importance = 2 '(0=Low, 1=Normal, 2=High)
objCDOMail.Subject = "Package Tracking ADP4ME Export Notification for
" & strDate & ""
objCDOMail.BodyFormat = 0
objCDOMail.MailFormat = 0 ' CdoMailFormatMime 'use for MS Outlook mail
objCDOMail.Body = "<html>" &_
"<head>" &_
"<title>Sending CDONTS Email Using HTML</title>" &_
"</head>" &_
"<body>" &_
"<div align=""center"">" &_
" <center>" &_
" <table border=""1"" cellspacing=""1""
width=""50%"">" &_
" <tr><td width=""100%""><p align=center><b><font
size=""5"">Package Tracking ADP4ME Export Notification</font></b></p></
td></tr>" &_
" <tr><td width=""100%""><p align=left><b>Machine
Number:</b> N/A</p></td></tr>" &_
" <tr><td width=""100%""><p align=left><b>Client
IP:</b> " & clientIP & "</p></td></tr>" &_
" <tr><td width=""100%""><p align=left><b>Date:</
b> " & FormatDateTime(Date,vbLongDate) & "</p></td></tr>" &_
" <tr><td width=""100%""><p align=left><b>Time:</
b> " & FormatDateTime(Time,vbLongTime) & "</p></td></tr>" &_
" <tr><td width=""100%""><p
align=left><b>Status:</b> " & strDate & " Export Completed
Successfully</p></td></tr>" &_
" </table>" &_
" </center>" &_
"</div>" &_
"</body>" &_
"</html>"
' send message
'objCDOMail.Send
' cleanup
Set objCDOMail = Nothing

Response.Write "<b><p align=center>The FedEx, UPS and DHL records for
<b>" & strDate & "</b> were processed successfully.</b></p>"
Response.Write "<p align=center>You may now close this browser
window.</p>"

objTextFile.Close
Set objTextFile = Nothing
oRSc.Close
Set oRSc = Nothing
oRSn.Close
Set oRSn = Nothing
Set objFSO = Nothing
objNetwork.RemoveNetworkDrive strDriveLetter
Set objNetwork = Nothing
oConn.Close
Set oConn = Nothing

%>

</body>
</html>
 
B

Billy

Hi All,

I'm attempting to use the MapNetworkDrive <snipped> below from entire
code below with very poor performance results.

Basically, I have very small 73kb text files that are rewritten daily
to a network share using the MapNetworkDrive command to connect to the
valid \\servername\share path.

After successfully connecting the drive in the ASP code, the text file
write process begins and takes more than 15 minutes to write the first
file when the asp page is executed. The process finally times out
since I have set the Server.ScriptTimeOut = 900 for testing purposes
which limits the asp page execution to 15 minutes. In that entire
time, the first file is viewable on the network share but only
partially completed. The additioanl files never complete.

I have done some troubleshooting by manually mapping the share
(outside of the ASP code) using Windows Explorer and copied the same
file that is being created in the routine from the IIS server to the
mapped drive - results are miliseconds to copy - excellent performance
this way.

Any idea of what would cause this performance hit from the looks of my
code? The server is IIS W2K3 and latest version of IIS and updates is
installed. We run many other ASP processes on the server successfully.

'<snip>

Set objNetwork = CreateObject("WScript.Network")
'objNetwork.RemoveNetworkDrive "M:"
strDriveLetter = "M:"
strRemotePath = "\\nad2divdb1\E_PT"
strUser = "Username"
strPassword = "Password"
strProfile = "False" ' means do not store in profile leave as false.
objNetwork.MapNetworkDrive strDriveLetter, strRemotePath, strProfile,
strUser, strPassword
' WScript.Quit

'<end snip>

Here is the entire page of code........

<html>

<head>
<title>Package Tracking Results - Client Feed</title>
</head>

<body>

<!-- #INCLUDE VIRTUAL="/nsceast/miscellaneous/adovbs.inc" --> <!--
Use "Virtual" rather than "File" for Virtual Path -->

<%
' set timeout for longer processing (default is 90 seconds)
Server.ScriptTimeOut = 900 ' In seconds - 300s = 5m

' define variables
dim oConn ' ADO Connection
dim oRSc ' ADO Recordset - Courier table
dim cfedexSQLstr ' SQL string - Courier table - FedEx
extraction
dim cupsSQLstr ' SQL string - Courier table - UPS
extraction
dim cdhlSQLstr ' SQL string - Courier table - DHL
extraction
dim oRSn ' ADO Recordset - NAN table
dim nSQLstr ' SQL string - NAN table
dim objFSO ' FSO Connection
dim objTextFile ' Text File
Dim i, j, tmp ' variables used for the Text File
Build process
Dim strMonth, strDay, strYear ' variables from user selection of
month/day/year
dim strDate ' variable to store complete date
dim cSwitch ' switch for Courier field(s) to
prevent extra comma when two spaces between fields occur
dim cSubSwitch ' subroutine loop switch (used to
determine clear of oRSc recordset)
dim objNetwork ' WScript drive access Connection
dim strRemotePath, strProfile, strUser, strPassword ' Additional
WScript variables

' set and open ADO connection
set oConn=Server.CreateObject("ADODB.connection")
oConn.Open "DRIVER={Microsoft Access Driver (*.mdb)};DBQ=" & "c:/
Database/QaTracking/QaTracking.mdb" & ";"

' set and define FSO connection and text file object location
Set objFSO = CreateObject("Scripting.FileSystemObject")

Set objNetwork = CreateObject("WScript.Network")
'objNetwork.RemoveNetworkDrive "M:"
strDriveLetter = "M:"
strRemotePath = "\\nad2divdb1\E_PT"
strUser = "Username"
strPassword = "Password"
strProfile = "False" ' means do not store in profile leave as false.
objNetwork.MapNetworkDrive strDriveLetter, strRemotePath, strProfile,
strUser, strPassword
'WScript.Quit

' Store User Month/Day/Year
strMonth = Request.QueryString("Month")
strDay = Request.QueryString("Day")
strYear = Request.QueryString("Year")
strDate = strMonth & "/" & strDay & "/" & strYear

' SQL strings for Courier and NAN tables
cfedexSQLstr = "SELECT * FROM Courier WHERE Courier.Courier = 'Fedex'
AND Courier.Date = #" & strDate & "#"
cupsSQLstr = "SELECT * FROM Courier WHERE Courier.Courier = 'UPS' AND
Courier.Date = #" & strDate & "#"
cdhlSQLstr = "SELECT * FROM Courier WHERE Courier.Courier = 'Airborne'
AND Courier.Date = #" & strDate & "#"
nSQLstr = "SELECT * FROM NAN"

' Initial Switch values
'cSwitch = "Off"
cSubSwitch = "Off"

'*******************************
'//// BUILD FEDEX TEXT FILE ////
'*******************************
Response.ContentType = "text/plain"
'cSwitch = "Off"
'------------------------------
'//// OPEN FEDEX RECORDSET ////
'------------------------------
set oRSc=Server.CreateObject("ADODB.Recordset")
oRSc.Open cfedexSQLstr, oConn
'------------------------------
'//// OPEN FEDEX TEXT FILE ////
'------------------------------
'Set objTextFile = objFSO.CreateTextFile(Server.MapPath("textfile.txt",
2))
'Response.Write (Server.MapPath("textfile.txt") & "<br />")
Set objTextFile = objFSO.OpenTextFile("M:\FED000.txt",2)
'--------------------------------------------
'//// CALL SUBROUTINE TO BUILD TEXT FILE ////
'--------------------------------------------
Call TextFileBuildLoop

'*****************************
'//// BUILD UPS TEXT FILE ////
'*****************************
Response.ContentType = "text/plain"
'cSwitch = "Off"
'----------------------------
'//// OPEN UPS RECORDSET ////
'----------------------------
set oRSc=Server.CreateObject("ADODB.Recordset")
oRSc.Open cupsSQLstr, oConn
'----------------------------
'//// OPEN UPS TEXT FILE ////
'----------------------------
'Set objTextFile =
objFSO.CreateTextFile(Server.MapPath("textfile.txt"))
'Response.Write (Server.MapPath("textfile.txt") & "<br />")
Set objTextFile = objFSO.OpenTextFile("C:\UPS000.txt",2)
'--------------------------------------------
'//// CALL SUBROUTINE TO BUILD TEXT FILE ////
'--------------------------------------------
Call TextFileBuildLoop

'*****************************
'//// BUILD DHL TEXT FILE ////
'*****************************
Response.ContentType = "text/plain"
'cSwitch = "Off"
'----------------------------
'//// OPEN DHL RECORDSET ////
'----------------------------
set oRSc=Server.CreateObject("ADODB.Recordset")
oRSc.Open cdhlSQLstr, oConn
'----------------------------
'//// OPEN DHL TEXT FILE ////
'----------------------------
'Set objTextFile =
objFSO.CreateTextFile(Server.MapPath("textfile.txt"))
'Response.Write (Server.MapPath("textfile.txt") & "<br />")
Set objTextFile = objFSO.OpenTextFile("C:\DHL000.txt",2)
'--------------------------------------------
'//// CALL SUBROUTINE TO BUILD TEXT FILE ////
'--------------------------------------------
cSubSwitch = "On"
Call TextFileBuildLoop

'*******************
'//// SUBROUTINE////
'*******************
SUB TextFileBuildLoop
'---------------------------------
'//// WRITE TEXT TO TEXT FILE ////
'---------------------------------
'objTextFile.WriteLine "This text is in the file ""textfile.txt""!"
'------------------------------------------------------
'//// BEGIN TEXT FILE BUILDING - LOOP THROUGH ROWS ////
'------------------------------------------------------
If Not oRSc.EOF Then
'-------------------------------------------------------------
'//// THIS PART PRODUCES THE FIRST TOP ROW OF FIELD NAMES ////
'-------------------------------------------------------------
' For i = 1 To oRSc.Fields.Count
' objTextFile.Write oRSc.Fields(i-1).Name
' If i < oRSc.Fields.Count Then
' objTextFile.Write " "
' End If
' Next
' objTextFile.WriteLine
' --------------------- // END // ----------------------------
While Not oRSc.EOF
For i = 1 To oRSc.Fields.Count
'------------------------------------------------------
'//// THIS PART ADDS QUOTES AROUND THE FIELD VALUE ////
'------------------------------------------------------
If oRSc.Fields(i-1) <> "" Then
tmp = oRSc.Fields(i-1)
' If TypeName(tmp) = "String" Then
' objTextFile.Write """" &_
'Replace(oRSc.Fields(i-1),vbCrLf,"""") & ""
' Else
'---------------------- // END // ---------------------
objTextFile.Write oRSc.Fields(i-1)
' End If
End If
' writes the space between fields
If i < oRSc.Fields.Count Then
' If cSwitch = "Off" Then
objTextFile.Write " "
' End If
End If
' If oRSc.Fields(i-1).Name = "Track" Then
' cSwitch = "On"
' Else
' cSwitch = "Off"
' End If
' loop through fields / stay on same record
Next
' go to next line in text file / move to next record
objTextFile.WriteLine
oRSc.MoveNext
Wend
End If
Set objTextFile = Nothing
If cSubSwitch = "Off" Then
Set oRSc = Nothing
End If
END SUB

'*****************************
'//// BUILD NAN TEXT FILE ////
'*****************************
Response.ContentType = "text/plain"
'----------------------------
'//// OPEN NAN RECORDSET ////
'----------------------------
set oRSn=Server.CreateObject("ADODB.Recordset")
oRSn.Open nSQLstr, oConn
'----------------------------
'//// OPEN NAN TEXT FILE ////
'----------------------------
'Set objTextFile =
objFSO.CreateTextFile(Server.MapPath("textfile.txt"))
'Response.Write (Server.MapPath("textfile.txt") & "<br />")
Set objTextFile = objFSO.OpenTextFile("C:\NAN000.txt",2)
'---------------------------------
'//// WRITE TEXT TO TEXT FILE ////
'---------------------------------
'objTextFile.WriteLine "This text is in the file ""textfile.txt""!"
'------------------------------------------------------
'//// BEGIN TEXT FILE BUILDING - LOOP THROUGH ROWS ////
'------------------------------------------------------
If Not oRSn.EOF Then
'-------------------------------------------------------------
'//// THIS PART PRODUCES THE FIRST TOP ROW OF FIELD NAMES ////
'-------------------------------------------------------------
' For i = 1 To oRSn.Fields.Count
' objTextFile.Write oRSn.Fields(i-1).Name
' If i < oRSn.Fields.Count Then
' objTextFile.Write " "
' End If
' Next
' objTextFile.WriteLine
' --------------------- // END // ----------------------------
While Not oRSn.EOF
For i = 1 To oRSn.Fields.Count
If oRSn.Fields(i-1) <> "" Then
tmp = oRSn.Fields(i-1)
'------------------------------------------------------
'//// THIS PART ADDS QUOTES AROUND THE FIELD VALUE ////
'------------------------------------------------------
' If TypeName(tmp) = "String" Then
' objTextFile.Write """" &_
'Replace(oRSn.Fields(i-1),vbCrLf,"""") & ""
' Else
'---------------------- // END // ---------------------
objTextFile.Write oRSn.Fields(i-1)
' End If
End If
If i < oRSn.Fields.Count Then
objTextFile.Write " "
End If
Next
objTextFile.WriteLine
oRSn.MoveNext
Wend
End If

Dim clientIP
clientIP = Request.ServerVariables("REMOTE_ADDR")

' define variable
dim objCDOMail
' create mail object
Set objCDOMail = Server.CreateObject("CDONTS.NewMail")
' compose message
objCDOMail.From = "CLI2-TRAINING <[email protected]>" 'this format
authors the e-mail as a name of your choice
objCDOMail.To = "(e-mail address removed);"
objCDOMail.Cc = ""
objCDOMail.Importance = 2 '(0=Low, 1=Normal, 2=High)
objCDOMail.Subject = "Package Tracking ADP4ME Export Notification for
" & strDate & ""
objCDOMail.BodyFormat = 0
objCDOMail.MailFormat = 0 ' CdoMailFormatMime 'use for MS Outlook mail
objCDOMail.Body = "<html>" &_
"<head>" &_
"<title>Sending CDONTS Email Using HTML</title>" &_
"</head>" &_
"<body>" &_
"<div align=""center"">" &_
" <center>" &_
" <table border=""1"" cellspacing=""1""
width=""50%"">" &_
" <tr><td width=""100%""><p align=center><b><font
size=""5"">Package Tracking ADP4ME Export Notification</font></b></p></
td></tr>" &_
" <tr><td width=""100%""><p align=left><b>Machine
Number:</b> N/A</p></td></tr>" &_
" <tr><td width=""100%""><p align=left><b>Client
IP:</b> " & clientIP & "</p></td></tr>" &_
" <tr><td width=""100%""><p align=left><b>Date:</
b> " & FormatDateTime(Date,vbLongDate) & "</p></td></tr>" &_
" <tr><td width=""100%""><p align=left><b>Time:</
b> " & FormatDateTime(Time,vbLongTime) & "</p></td></tr>" &_
" <tr><td width=""100%""><p
align=left><b>Status:</b> " & strDate & " Export Completed
Successfully</p></td></tr>" &_
" </table>" &_
" </center>" &_
"</div>" &_
"</body>" &_
"</html>"
' send message
'objCDOMail.Send
' cleanup
Set objCDOMail = Nothing

Response.Write "<b><p align=center>The FedEx, UPS and DHL records for
<b>" & strDate & "</b> were processed successfully.</b></p>"
Response.Write "<p align=center>You may now close this browser
window.</p>"

objTextFile.Close
Set objTextFile = Nothing
oRSc.Close
Set oRSc = Nothing
oRSn.Close
Set oRSn = Nothing
Set objFSO = Nothing
objNetwork.RemoveNetworkDrive strDriveLetter
Set objNetwork = Nothing
oConn.Close
Set oConn = Nothing

%>

</body>
</html>

I'm going to post my own answer here since I've researched and seen
others stuck on this same problem. The issue I found was that I was
trying to *build* and process the entire file on the network share. If
you build the file locally, then copy it over with the objFileCopy
command (I think it's an FSO object) then the ASP execution is super
fast.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,969
Messages
2,570,161
Members
46,709
Latest member
AustinMudi

Latest Threads

Top