开发者

Using DocumentPrint in ASP.NET

I made a small web application (ASP.NET) that use the DocumentPrint.Print() to use a printer that connected on the server and when run it from the visual studio its work well and print the document correctly, Hint : the address will be : http://localhost:8080/ but when use the iis server (http://localhost/TestPrintingWebSite) the printer never work and then the website didnt effect to the server printer.

is there any setting must be on the iis to开发者_Go百科 let me able to use the server printer ???

please your help guys ;)

thanks alot


By default in IIS, the account used to run ASP.NET applications will lack sufficient privelages to access the network printer.

In order to access the printer you will need to either use impersonation in your code:

WindowsIdentity.Impersonate Method

Or configure IIS to run the application under a user account with the required privileges.

Here is another article which explains different methods of impersonation security:

Understanding ASP.NET Impersonation Security


Edit

If you do not feel confident implementing the user impersonation code yourself, here is a link to a codeproject article: (the code is in c# but could be easily converted to VB.NET or compiled into a separate class library and used in your application)

A small C# Class for impersonating a User

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜