开发者

ASP.NET Anonymous user cannot print to a network printer

I have an ASP.NET application where user is Anonymous when he connects to website. Also I have a printing server inside network. I want to let this user to print to the 开发者_开发问答network printer.

In order to print I have to use File.Copy command. When I do this I get "Access denied". So I tried to impersonate the user with credentials of user that is inside domain and has the rights to print to that specific printer.

The problem is this user has to be Administrator, and I cannot let him be the Administrator. When this user is not Administrator then the printing is not working ("Access denied").

I tried to use Network Credentials but I don't know how to set credentials to command File.Copy. This command doesn't have any extensions or overloading for credentials.

Any help will be appreciated :)


You should just grant write access to the folder that you are copying to. Right click on the folder and choose Properties -> Security. Then add the user that you are impersonating in asp.net. You can do the same thing for the anonymous user, although it's a bit more complicated.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜