Last post Sep 11, 2014 04:20 AM by Starain chen - MSFT
Sep 08, 2014 06:03 PM|ItsMeMac|LINK
Windows authentication in ASP.NET MVC .NET 4.5.1 doesn't read new IsInRole value after add/remove user to/from Role with IE
I work on ASP.NET MVC (.NET 4.5.1, C#) application that uses Windows authentication mode.
Everything works fine with one exception. After I add or remove User from Windows Group, client application still remember old values. Moreover, this affects only in Internet Explorer. When I use Firefox, it CAN read and display proper IsInRole in few seconds
after Windows User was added / removed from Windows Group. Why IE can't read changed values?
I do not use Visual Studio built in IIS. Instead of this I use my local IIs
I tried to use following code, but with no success:
IPrincipal p = Thread.CurrentPrincipal;
Part of my web.config:
<identity impersonate="false" />
<authentication mode="Windows" />
<deny users="?" />
My development environment is Win 8.1, VS 2013, IIS
Sep 08, 2014 08:36 PM|BrockAllen|LINK
IIS caches the token values for 15 minutes IIRC. In other words, if you make a change in AD then your local IIS will need to have its cache expire or be purged (via a restart) for the updated values in AD to be seen.
Sep 09, 2014 07:31 AM|ItsMeMac|LINK
Thank you for your comment. Unfortunately, nothing happen after 15, 20 and even 30 minutes after I removed user from group.
Please consider, that under Firefox it works immediately.
Moreover, when i run application in debug mode with two browsers IE and FF with p.IsInRole("my_gorup_name") in the watch, a proper value is in FF session and invalid value is in IE session.
Sep 09, 2014 09:36 AM|BrockAllen|LINK
Ah, ok, if FF updates immediately but the others don't then it sounds as if the browser itself is doing the caching. So try starting a new browser.
Sep 09, 2014 10:49 AM|ItsMeMac|LINK
Nope ... it still doesn't read current values :(
Sep 11, 2014 04:20 AM|Starain chen - MSFT|LINK
Please use the developer tool to check whether that request status is not 304.