1 minute delay to access Printer Share

S

Salty Dog

Code:
<%Response.Buffer = False%>
<HTML>
<HEAD>
<title>Printing</title>
</HEAD>
<BODY>
<center>
<%
FilePath = "c:\WUTemp\441817810_receiver.txt"
'PrinterShare = "\\Garchive\ISLaser"
PrinterShare = "\\Meta3\OKIDATA"

Set objFSO = Server.CreateObject("Scripting.FileSystemObject")

Set objFile = objFSO.OpenTextFile(FilePath,1,True)
strReadAll = objFile.ReadAll
Set objFile = nothing

on error resume next

Set objFile = objFSO.CreateTextFile(PrinterShare)
objFile.write(strReadAll)
Set objFile = nothing

Set objFSO = nothing

Response.Write("Priting...<br><br>Please wait.")
'Response.Write(Err.number)
'Response.End
%>

<script language=javascript>
var Err = <%=Err.number%>;
if (Err != 0) {
self.setTimeout('window.location.reload();', 65000);
}
else{
window.close();
}
</script>

</BODY>
</HTML>

Here is the workaround that I'm using to try accessing the Printer share and
if error then wait 65 seconds and then it prints without error. Any ideas
what might cause this and how to avoid the 1 minute delay workaround? Thanks
in advance!

If I'm not doing something wrong, should this be a bug report?
 
P

Patrice

It's best to keep the current thread rather than posting a new message for
which we don't know what is the context and what others may have already
suggested...

Also what is the exact error ? For now I would say it waits before printing
because there is no formfeed character to tell you are done with the page...

Patrice
 
S

Salty Dog

Thanks for the single thread tip. I was beginning to notice that after
waiting a while for a response, I would get quick response to a new thread.
I'll try to be more patient.

The error is "Permission denied". Without any other changes but waiting
after the first attempt the code works. Also, this code did not require this
delay workaround until just recently. This makes me think that one of the
security updates changed the environment.

Any ideas? Thanks in advance!
 
P

Paul Baker

I would call fso.CopyFile <text file name>, <printer share name>. It is
simpler and also more likely to succeed.

Does that help?

Paul
 
S

Salty Dog

Way simpler and I'll use this cool technique going forward but still errors
with error '800a0046' Permission denied. Dang, I thought you had it but not
quite!
 
P

Paul Baker

This is running in an ASP?

You need to check the Directory Security settings on the IIS folder. Is the
user logging in as an anoymous IUSR or as a Windows user? You need to pay
attention to what they log in as. Remember that the browser can be
configured to automatically send credentials if challenged, so there may be
no logon dialog.

You need to check the permissions of the printer share.

Permission denied is permission denied. Check permissions.

Paul
 
S

Salty Dog

Yes this is a webpage and the anonymous user is a domain admin at least
temporarily until I can get this to work without the delay and I'll tighten
security.
Keep in mind that this code will run without changes after waiting 1 minute.
That's the funky part... permission denied but after waiting 1 minute and
not changing anything, permission granted. That's where I'm thinking that
the permissions are configured properly or it would never succeed. What do
think is up with this some kind of delayed permissions??? Thanks so much for
your help!
 

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,771
Messages
2,569,587
Members
45,099
Latest member
AmbrosePri
Top