I don't know exactly how to explain it, but here is basically how my problem could be reproduced:
- Create a WPF Windows Application Project in VB.NET (don't create, just keep reading this, unless you don't believe me...)
- Click the Window's header to create a Window.Loaded event-handler and to navigate to it.
- Add the following to the event-handler:
My.User.CurrentPrincipal = New GenericPrincipal( _
New GenericIdentity("username"), Nothing)
Dim authenticated = My.User.CurrentPrincipal.IsAuthenticated
MessageBox.Show(authenticated) 'True' - Go back to the window designer and add a Button to the Window1.
- Click the Button to create its Click event-handler and navigate to it.
- Add the following content to it:
Dim authenticated = My.User.CurrentPrincipal.IsAuthenticated
MessageBox.Show(authenticated) 'False' - Run the application, see the results
- WHY ON THE EARTH IS IT FALSE NOW!?!?
UPDATE: I reported a bug at: http://connect.microsoft.com/WPF/feedback/ViewFeedback.aspx?FeedbackID=513731, please vote or post a workaround, and update me when you do so, thanks in advance.
Any workarounds will be welcommed!