O'Reilly logo

Microsoft® Visual Basic® .NET Programmer's Cookbook by Matthew MacDonald

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Impersonate the IIS User with ASP.NET

Problem

You want to impersonate the Internet Information Services (IIS) authenticated user in your Web page or Web service code.

Solution

Retrieve a WindowsIdentity object that represents the authenticated user from the built-in User object. You can use this identity to perform impersonation with the WindowsIdentity.Impersonate method.

Discussion

In an ASP.NET application, all code runs under a special worker or local system account that has the necessary privileges for running Web page and Web service code. In some situations, however, it might be useful to run part of the application logic under a user-specific account. For example, if you have a file-lookup service, you might want to use Windows access control ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required