P
Pascal Gineste
We want to convert an excel file to a pdf file using a PDF printer
driver.
This uses a Postscript printer driver with a redirected port
"PDFCreator sur Ne00:"
to print with asp.net; i impersonate with code with logonuser and
duplicatetoken (i tried also duplicatetokenex with primary token and
also
SecurityDelegation).
the user (Usr1) i use to impersonate is administrateur of the serveur
and he can
access the directory where the excel and pdf will be generated.
the excel file is generated correctly (with OleDb and configuring
dcomcnfg)
however, after impersonating, i reopen the excel file (with OleDb) and
i
execute :
Workbook.PrintOut(1, iNbPages, 1, false, sNomImprimante,missing,
missing,missing);
-> it blocks if the user i mention (Usr1 of domain Domn1) during
impersonation by code is not logged
in on the server.
however, if Usr1 is logged on on the server, the pdf file is generated
correctly.
The problem is that i don't want the web server to be logged on always
with
this user account usr1.
I have found a temporary solution (not very secure .....) : if i start
aspnet_wp.exe with Domn1\Usr1, it works correctly and i don't need
anymore
to be logged on the server and i also don't need anymore to
impersonate
by code as usr1.
Have you got any idea ?
Thanks in advance
driver.
This uses a Postscript printer driver with a redirected port
"PDFCreator sur Ne00:"
to print with asp.net; i impersonate with code with logonuser and
duplicatetoken (i tried also duplicatetokenex with primary token and
also
SecurityDelegation).
the user (Usr1) i use to impersonate is administrateur of the serveur
and he can
access the directory where the excel and pdf will be generated.
the excel file is generated correctly (with OleDb and configuring
dcomcnfg)
however, after impersonating, i reopen the excel file (with OleDb) and
i
execute :
Workbook.PrintOut(1, iNbPages, 1, false, sNomImprimante,missing,
missing,missing);
-> it blocks if the user i mention (Usr1 of domain Domn1) during
impersonation by code is not logged
in on the server.
however, if Usr1 is logged on on the server, the pdf file is generated
correctly.
The problem is that i don't want the web server to be logged on always
with
this user account usr1.
I have found a temporary solution (not very secure .....) : if i start
aspnet_wp.exe with Domn1\Usr1, it works correctly and i don't need
anymore
to be logged on the server and i also don't need anymore to
impersonate
by code as usr1.
Have you got any idea ?
Thanks in advance