Link to home
Start Free TrialLog in
Avatar of amruthanet
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\esummary\output\") & Session("randomFileName")
Set fso = CreateObject("Scripting.FIleSystemObject")
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.Message") 'new
Set objConfiguration = Server.CreateObject("CDO.Configuration") 'new
Set colFields = objConfiguration.Fields

 With colFields
  .Item(cdoSendUsingMethod) = cdoSendUsingPort   'this is a smart host
  .Item(cdoSMTPServer) = "daismtp.daweb.gov.state.ks.us"       'Mail Server IP address
  .Item(cdoSendUserName) = ""
  .Item(cdoSendPassword) = ""
  .Item(cdoSMTPAuthenticate) = cdoBasic          'other values: cdoAnomymous (default), cdoNTLM
  .Item(cdoSMTPConnectionTimeout) = 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.state.ks.us"
 .From = Session("emailaddress")
 .Subject = "Online Employment Application- " & Session("LastName")& ": " & Session("VacancyRequisition")
 .TextBody = Session("FirstName") & " " & Session("LastName") & " " &  "has applied for Vacancy Requistion " & Session("VacancyRequisition") & ": " & Session("JobTitle")& ". " & "Please see the attached Employment Application file."

dim pdfFile
pdfFile = Session("randFileHolding")
.AddAttachment ("\\daweb\dofa\Dev2\Esummary\Output\" & Session("randFileHolding") & ".pdf") --- Something wrong here
           
 '.HTMLBody = sBodyHTML
  .Send()
 End With

 Set objMessage = Nothing
 Set objConfiguration = Nothing
 '**end new cdo code
Avatar of Lee
Lee
Flag of United Kingdom of Great Britain and Northern Ireland image

Hi,

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
Avatar of DireOrbAnt
DireOrbAnt

Do a:
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\esummary\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.
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.
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?
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.
Avatar of amruthanet

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\esummary\output\") & Session("randomFileName")
Set fso = CreateObject("Scripting.FIleSystemObject")
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.Message") 'new
Set objConfiguration = Server.CreateObject("CDO.Configuration") 'new
Set colFields = objConfiguration.Fields

 With colFields
  .Item(cdoSendUsingMethod) = cdoSendUsingPort   'this is a smart host
  .Item(cdoSMTPServer) = "daismtp.daweb.gov.state.ks.us"       'Mail Server IP address
  .Item(cdoSendUserName) = ""
  .Item(cdoSendPassword) = ""
  .Item(cdoSMTPAuthenticate) = cdoBasic          'other values: cdoAnomymous (default), cdoNTLM
  .Item(cdoSMTPConnectionTimeout) = 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.state.ks.us"
 .From = Session("emailaddress")
 .Subject = "Online Employment Application- " & Session("LastName")& ": " & Session("VacancyRequisition")
 .TextBody = Session("FirstName") & " " & Session("LastName") & " " &  "has applied for Vacancy Requistion " & Session("VacancyRequisition") & ": " & Session("JobTitle")& ". " & "Please see the attached Employment Application file."

dim pdfFile
pdfFile = Session("randFileHolding")
.AddAttachment ("\\daweb\dofa\Dev2\Esummary\Output\" & Session("randFileHolding") & ".pdf") --- Something wrong here
           
 '.HTMLBody = sBodyHTML
  .Send()
 End With

 Set objMessage = Nothing
 Set objConfiguration = Nothing
 '**end new cdo code
Are you setting APServer.OutputDirectory somewhere?
APServer.OutputDirectory = sPDFDir

  sPDFDir = Server.MapPath ("\\daweb\dofa\Dev2\Esummary\Output\")
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\"
I think you mean...
sPDFDir = "\\daweb\dofa\Dev2\Esummary\Output\"
Yeah, sorry :)
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,
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,
ASKER CERTIFIED SOLUTION
Avatar of DireOrbAnt
DireOrbAnt

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
IIS will need permissions to write to the remote machine.  This involves duplicating the IUSR account on the remote machine and granting it permission.