Hi
I've just done exactly this.....
I went down a few dead ends before getting there....
I initially formatted my Zebra label in ZPL in a txt file, and used a CMD
line TYPE label.txt > \\computername\printershare
The label printed fine. However, I then started to code this using interop
making calls to the Win32 API to direct print.
The prints did not happen, and I was baffled. I wasn't sure why it wasn't
printing, so I then had my code shell out to a CMD line, and run the same
TYPE redirect to the printer.
This didn't work!! It worked from my own command line, but not when the code
shelled it....
Its a permission problem. The ASPNET account doesn't have permissions to the
printer in a corporate network environment.
To get round this I added the following line to web.config
<Identity Impersonate = true />
This makes the requests on the server run in the security context of the web
requestor (ie. a valid user, and not the ASPNET account)
I expected this to work..... but it did not..... :-((
The problem was that I was still shelling out to execute the TYPE, and when
you do this, the account runs under ASPNET again!!!
I re-instated my direct print code in windows, and it worked straight away!!!
To summise:
- add <identity impersonate = true /> to your web.config file
- make an interop call back to the Win32 API to execute direct printing to a
printer share.
I have some sample code if you would like it.
Good luck.. HTH
Paul
MCSD, MCDBA