IIS7 integrated mode closing token between requests

Posted by user607287 on Stack Overflow See other posts from Stack Overflow or by user607287
Published on 2011-02-07T23:23:01Z Indexed on 2011/02/07 23:25 UTC
Read the original article Hit count: 277

We are migrating to IIS7 integrated mode and have come across an issue. We authenticate using WindowsAuthentication but then store a reference to the WindowsPrincipal so that on future requests we can authorize as needed against AD. In IIS 7 Integrated mode, the token is being closed (between requests) so that when we try to run IsInRole it generates a disposed exception. Is there a way to cache this token or change our use of WindowsPrincipal so that we don't need to make successive AD requests to get it for each authorization request?

Here is the exception being thrown from WindowsPrincipal.IsInRole("") - System.ObjectDisposedException: {"Safe handle has been closed"}

Thanks.

© Stack Overflow or respective owner

Related posts about security

Related posts about authentication