Skip to content

OperationContext.Current.ServiceSecurityContext.PrimaryIdentity.Name #11

@TheAggie

Description

@TheAggie

When running my project on my DiscountAsp.Net Windows 2008 Server w/ IIS7 and .Net 4.0 I'm not able to access the current username w/ a call to OperationContext.Current.ServiceSecurityContext.PrimaryIdentity.Name. Trying to do so results in a System.NullReferenceException: Object reference not set to an instance of an object exception. I've checked my Web.config and other settings time and time again and haven't found any reasonable explanation for this as I know OpeartionContextExtensions was meant to fix this problem.

Interestingly enough I tried the hack in which you decode and parse the Authentication Headers to get the username/password and this worked sometimes, but other times lead to the exact same error using the exact same request in fiddler.

One thing I found especially interesting was that once it did get the username correctly using this method, requests afterward also seamed to work. However, Session State was disabled in IIS Manager the whole time. I need to access the username 100% of the time however so even this is not good enough.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions