Web Development

General discussion

Locked

VB6 "Permission denied" only sometimes

By semmelbroesel ·
Hi,
I wrote a little VB6 program that is being called by my email server when a certain email comes in. The program is then supposed to access a file on another PC on the LAN and create an email out of that file.

Theoretically it works perfectly, but sometimes when the email server starts the program I get a "Permission Denied" error.
If I start the program by hand it works perfectly.

I am not using any command line parameters - I just start the program, and it does all by itself.

The path is correct and the same in both cases.

Both PCs are running Windows XP.

I tried having the email server start a little program whose only purpose was to start my main program - I wanted to see if there was something in the way that my email server starts the program that would deny it access - that didn't help either.

I tried multiple ways of accessing the file (pretty much all I could find), and all give the same result. Also, I have not been able to get any query to work that tells me if the target file exists. Usually it works, but not via network.

I don't think it has to do with my code since I tried multiple approaches, but there has to be something in the Windows permissions etc. that won't let my program through...

Any ideas?

Thanks!

This conversation is currently closed to new comments.

Thread display: Collapse - | Expand +

All Comments

Collapse -

by dryflies In reply to VB6 "Permission denied" o ...

I think it is who the program runs as. try logging in as the same user that runs the e-mail server and see if you get the error when you launch it manually.

given the info you have provided, the error has four possible sources:
accessing the trigger e-mail
executing the script
reading the remote file
creating the new e-mail

so make sure each of those possible causes is eliminated. Give permission for the e-mail server user to access the trigger mail, execute your script, open and read the remote file, create a new e-mail. place a message box here and there to let you know where you are in the process to narrow down the cause. when you isolate which event is access denied, it should be a simple thing to fix. if not, reject the answer and leave a comment with the new information isolating the cause.

Collapse -

by semmelbroesel In reply to VB6 "Permission denied" o ...

I am running plain Windows XP with Admin permissions (the only user account), so I don't think there are any permissions I can set that would help.

We can exclude "creating the new email file" as a source because the program stops before that.
We can also exclude "accessing the trigger e-mail" because my program shows the data it received, and it parses it normally.
Reading the remote file works fine if I start the program by hand.

Hm, just had a thought...
My email server needs to be started using an included loader program so it can automatically restart itself for maintenance. To make sure that this loader starts automatically in case the PC reboots (power failure etc.), I used SRVANY.EXE to start it as a service, and my FTP server also.
I need to check my settings there again to see if it has different permissions there.

The error happens exactly while my program is trying to access the file over the network, and again: This works fine when I run the program by hand instead of the mail server running it.

Sorry it took me so long to get back to this one, I was busy and forgot about it. I hope there is still an answer out there for me.

Thanks!

Related Discussions

Related Forums