amruthanet
asked on
Urgent -Microsoft VBScript runtime error '800a0034' error - Please help
Hi,
I am gettig the following error. Please help
Microsoft VBScript runtime error '800a0034'
Bad file name or number
/ps/esummary/es_online/ES1 .asp, line 102
Code:
<%
'------------------------- ----
'File Creation
'------------------------- ----
If Session("submitted") = true then
Filename = ("\\daweb\dofa\Dev2\esumma ry\output\ ") & Session("randomFileName")
Set fso = CreateObject("Scripting.FI leSystemOb ject")
Set f = fso.OpenTextFile(FileName, ForWriting ,True) ------ Error
%>
Below code is what sending the email as an attachment and that file was try to open in the above code:
Set objMessage = Server.CreateObject("CDO.M essage") 'new
Set objConfiguration = Server.CreateObject("CDO.C onfigurati on") 'new
Set colFields = objConfiguration.Fields
With colFields
.Item(cdoSendUsingMethod) = cdoSendUsingPort 'this is a smart host
.Item(cdoSMTPServer) = "daismtp.daweb.gov.state.k s.us" 'Mail Server IP address
.Item(cdoSendUserName) = ""
.Item(cdoSendPassword) = ""
.Item(cdoSMTPAuthenticate) = cdoBasic 'other values: cdoAnomymous (default), cdoNTLM
.Item(cdoSMTPConnectionTim eout) = 120 'timeout = 30 seconds --> changed to 2 minutes
.Item(cdoSMTPServerPort) = 25
.Update
End With
With objMessage
Set .Configuration = objConfiguration
'.To = Session("StateAgency")
.To = "amrutha.ravikumar@da.stat e.ks.us"
.From = Session("emailaddress")
.Subject = "Online Employment Application- " & Session("LastName")& ": " & Session("VacancyRequisitio n")
.TextBody = Session("FirstName") & " " & Session("LastName") & " " & "has applied for Vacancy Requistion " & Session("VacancyRequisitio n") & ": " & Session("JobTitle")& ". " & "Please see the attached Employment Application file."
dim pdfFile
pdfFile = Session("randFileHolding")
.AddAttachment ("\\daweb\dofa\Dev2\Esumma ry\Output\ " & Session("randFileHolding") & ".pdf") --- Something wrong here
'.HTMLBody = sBodyHTML
.Send()
End With
Set objMessage = Nothing
Set objConfiguration = Nothing
'**end new cdo code
I am gettig the following error. Please help
Microsoft VBScript runtime error '800a0034'
Bad file name or number
/ps/esummary/es_online/ES1
Code:
<%
'-------------------------
'File Creation
'-------------------------
If Session("submitted") = true then
Filename = ("\\daweb\dofa\Dev2\esumma
Set fso = CreateObject("Scripting.FI
Set f = fso.OpenTextFile(FileName,
%>
Below code is what sending the email as an attachment and that file was try to open in the above code:
Set objMessage = Server.CreateObject("CDO.M
Set objConfiguration = Server.CreateObject("CDO.C
Set colFields = objConfiguration.Fields
With colFields
.Item(cdoSendUsingMethod) = cdoSendUsingPort 'this is a smart host
.Item(cdoSMTPServer) = "daismtp.daweb.gov.state.k
.Item(cdoSendUserName) = ""
.Item(cdoSendPassword) = ""
.Item(cdoSMTPAuthenticate)
.Item(cdoSMTPConnectionTim
.Item(cdoSMTPServerPort) = 25
.Update
End With
With objMessage
Set .Configuration = objConfiguration
'.To = Session("StateAgency")
.To = "amrutha.ravikumar@da.stat
.From = Session("emailaddress")
.Subject = "Online Employment Application- " & Session("LastName")& ": " & Session("VacancyRequisitio
.TextBody = Session("FirstName") & " " & Session("LastName") & " " & "has applied for Vacancy Requistion " & Session("VacancyRequisitio
dim pdfFile
pdfFile = Session("randFileHolding")
.AddAttachment ("\\daweb\dofa\Dev2\Esumma
'.HTMLBody = sBodyHTML
.Send()
End With
Set objMessage = Nothing
Set objConfiguration = Nothing
'**end new cdo code
Do a:
Response.Write(Filename)
Just before the OpenTextFile to see if the file name is what you are expecting
Response.Write(Filename)
Just before the OpenTextFile to see if the file name is what you are expecting
Since FSO is executed on the server you can't use UNC patchs. Everything is referenced relative to the WWWRoot folder. You also have to use "/" instead of "\"
Change:
Filename = ("\\daweb\dofa\Dev2\esumma ry\output\ ") & Session("randomFileName")
TO:
Filename = server.MapPath("/dofa/Dev2 /esummary/ output/" & Session("randomFileName")
I am assuming that /dofa is the top directory under WWWRoot for this server and daweb is the server name.
Change:
Filename = ("\\daweb\dofa\Dev2\esumma
TO:
Filename = server.MapPath("/dofa/Dev2
I am assuming that /dofa is the top directory under WWWRoot for this server and daweb is the server name.
Sorry, but FSO can only read Local Files!
I think this is a permissions issue.
FSO can (definitely) access UNC paths - I just did it, and (I believe) mapped drives.
I would guess that this code is being executed by the IUSR_servername account, and suspect that this account does not have permission to either write to the target directory, and/or move (ie delete) from the source directory.
FSO can (definitely) access UNC paths - I just did it, and (I believe) mapped drives.
I would guess that this code is being executed by the IUSR_servername account, and suspect that this account does not have permission to either write to the target directory, and/or move (ie delete) from the source directory.
With apologies to lsavidge who pointed this out earlier!
Could also try...
Set f = fso.OpenTextFile(FileName, 2,True)
Also, what's the diffenece between randomFileName and randFileHolding?
Set f = fso.OpenTextFile(FileName,
Also, what's the diffenece between randomFileName and randFileHolding?
Come to think of it I have a ASP app that is using FSO over UNC paths now.
Open mouth and insert foot. I was quoting something I googled which was incorrect.
Open mouth and insert foot. I was quoting something I googled which was incorrect.
ASKER
Hi guys,
Sorry it took me a while, I was not able to connect to my work station.
The problem the code I have given above, creates the text file and that text file as a session("randomfilename") used to create a .pdf file. I have given that code also here.
We are getting the .txt file part working fine, but when creates the .pdf it assigns a name and .pdf to that file, but not able to write to the same location where .txt got created. I have given the code here.
We are using the IUSR_servername account, with the modify rights and again its working perfect for text files but does not work for pdf.
We are using activepdf to create pdf files.
Please help.
__________________________ __________ __________ __________ __________ __________ __________ __________ __
'pdf creation....
__________________________ __________ __________ __________ __________ __________ __________ ____
Dim randfile
Dim RandfileHolding
randfile = Session("randomFileName")
RandfileHolding = Left(randfile,11)
Session("RandFileHolding") = RandFileHolding
APServer.NewDocumentName = RandfileHolding & ".pdf"
APServer.StartPrinting
__________________________ __________ __________ __________ __________ __________ __________ __________ _
<%
'------------------------- ----
'File Creation- text file
'------------------------- ----
If Session("submitted") = true then
Filename = ("\\daweb\dofa\Dev2\esumma ry\output\ ") & Session("randomFileName")
Set fso = CreateObject("Scripting.FI leSystemOb ject")
Set f = fso.OpenTextFile(FileName, ForWriting ,True)
%>
Below code is what sending the email as an attachment and that file was try to open in the above code:
Set objMessage = Server.CreateObject("CDO.M essage") 'new
Set objConfiguration = Server.CreateObject("CDO.C onfigurati on") 'new
Set colFields = objConfiguration.Fields
With colFields
.Item(cdoSendUsingMethod) = cdoSendUsingPort 'this is a smart host
.Item(cdoSMTPServer) = "daismtp.daweb.gov.state.k s.us" 'Mail Server IP address
.Item(cdoSendUserName) = ""
.Item(cdoSendPassword) = ""
.Item(cdoSMTPAuthenticate) = cdoBasic 'other values: cdoAnomymous (default), cdoNTLM
.Item(cdoSMTPConnectionTim eout) = 120 'timeout = 30 seconds --> changed to 2 minutes
.Item(cdoSMTPServerPort) = 25
.Update
End With
With objMessage
Set .Configuration = objConfiguration
'.To = Session("StateAgency")
.To = "amrutha.ravikumar@da.stat e.ks.us"
.From = Session("emailaddress")
.Subject = "Online Employment Application- " & Session("LastName")& ": " & Session("VacancyRequisitio n")
.TextBody = Session("FirstName") & " " & Session("LastName") & " " & "has applied for Vacancy Requistion " & Session("VacancyRequisitio n") & ": " & Session("JobTitle")& ". " & "Please see the attached Employment Application file."
dim pdfFile
pdfFile = Session("randFileHolding")
.AddAttachment ("\\daweb\dofa\Dev2\Esumma ry\Output\ " & Session("randFileHolding") & ".pdf") --- Something wrong here
'.HTMLBody = sBodyHTML
.Send()
End With
Set objMessage = Nothing
Set objConfiguration = Nothing
'**end new cdo code
Sorry it took me a while, I was not able to connect to my work station.
The problem the code I have given above, creates the text file and that text file as a session("randomfilename") used to create a .pdf file. I have given that code also here.
We are getting the .txt file part working fine, but when creates the .pdf it assigns a name and .pdf to that file, but not able to write to the same location where .txt got created. I have given the code here.
We are using the IUSR_servername account, with the modify rights and again its working perfect for text files but does not work for pdf.
We are using activepdf to create pdf files.
Please help.
__________________________
'pdf creation....
__________________________
Dim randfile
Dim RandfileHolding
randfile = Session("randomFileName")
RandfileHolding = Left(randfile,11)
Session("RandFileHolding")
APServer.NewDocumentName = RandfileHolding & ".pdf"
APServer.StartPrinting
__________________________
<%
'-------------------------
'File Creation- text file
'-------------------------
If Session("submitted") = true then
Filename = ("\\daweb\dofa\Dev2\esumma
Set fso = CreateObject("Scripting.FI
Set f = fso.OpenTextFile(FileName,
%>
Below code is what sending the email as an attachment and that file was try to open in the above code:
Set objMessage = Server.CreateObject("CDO.M
Set objConfiguration = Server.CreateObject("CDO.C
Set colFields = objConfiguration.Fields
With colFields
.Item(cdoSendUsingMethod) = cdoSendUsingPort 'this is a smart host
.Item(cdoSMTPServer) = "daismtp.daweb.gov.state.k
.Item(cdoSendUserName) = ""
.Item(cdoSendPassword) = ""
.Item(cdoSMTPAuthenticate)
.Item(cdoSMTPConnectionTim
.Item(cdoSMTPServerPort) = 25
.Update
End With
With objMessage
Set .Configuration = objConfiguration
'.To = Session("StateAgency")
.To = "amrutha.ravikumar@da.stat
.From = Session("emailaddress")
.Subject = "Online Employment Application- " & Session("LastName")& ": " & Session("VacancyRequisitio
.TextBody = Session("FirstName") & " " & Session("LastName") & " " & "has applied for Vacancy Requistion " & Session("VacancyRequisitio
dim pdfFile
pdfFile = Session("randFileHolding")
.AddAttachment ("\\daweb\dofa\Dev2\Esumma
'.HTMLBody = sBodyHTML
.Send()
End With
Set objMessage = Nothing
Set objConfiguration = Nothing
'**end new cdo code
Are you setting APServer.OutputDirectory somewhere?
ASKER
APServer.OutputDirectory = sPDFDir
sPDFDir = Server.MapPath ("\\daweb\dofa\Dev2\Esumma ry\Output\ ")
sPDFDir = Server.MapPath ("\\daweb\dofa\Dev2\Esumma
Hum... MapPath is used to map a virtual directory to a physical one. You seem to be using a UNC here. Maybe:
sPDFDir = \\daweb\dofa\Dev2\Esummary \Output\"
sPDFDir = \\daweb\dofa\Dev2\Esummary
I think you mean...
sPDFDir = "\\daweb\dofa\Dev2\Esummar y\Output\"
sPDFDir = "\\daweb\dofa\Dev2\Esummar
Yeah, sorry :)
ASKER
Thanks. I tried but did not work.
Since we are using active pdf 3.5.2, it seems like there are some problems writing to the remote place. We have been consulting the activepdf and I will let you know as soon as I found some solution.
Thanks,
Since we are using active pdf 3.5.2, it seems like there are some problems writing to the remote place. We have been consulting the activepdf and I will let you know as soon as I found some solution.
Thanks,
ASKER
Is any way we can write to a local file and then move it to a remote location? Please help.
Can someone give some example how to write to a local file and then move?
any help is greatly appreciated.
Thanks,
Can someone give some example how to write to a local file and then move?
any help is greatly appreciated.
Thanks,
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
IIS will need permissions to write to the remote machine. This involves duplicating the IUSR account on the remote machine and granting it permission.
I suspect that this is a permissions problem. When the file is opened or created in the OpenTextFile method call, the user that does this is something like IUSR_<machine_name>. Does this user have the correct permissons to be able to write to the file?
Regards,
Lee