Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3402476
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T05:08:34+00:00 2026-05-18T05:08:34+00:00

How do I to tell what context an application is running under? That is,

  • 0

How do I to tell what context an application is running under?

That is, user context, system context, etc… Is there some code I can run to tell? P/Invoke or something?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-18T05:08:34+00:00Added an answer on May 18, 2026 at 5:08 am

    Look at the .NET class ServiceSecurityContext.Current -> http://msdn.microsoft.com/en-us/library/system.servicemodel.servicesecuritycontext.aspx

    E.g. The following example from MSDN shows you how to use this class

    // Run this method from within a method protected by the PrincipalPermissionAttribute
    // to see the security context data, including the primary identity.
    public void WriteServiceSecurityContextData(string fileName)
    {
        using (StreamWriter sw = new StreamWriter(fileName))
        {
            // Write the primary identity and Windows identity. The primary identity is derived from
            // the credentials used to authenticate the user. The Windows identity may be a null string.
            sw.WriteLine("PrimaryIdentity: {0}", ServiceSecurityContext.Current.PrimaryIdentity.Name);
            sw.WriteLine("WindowsIdentity: {0}", ServiceSecurityContext.Current.WindowsIdentity.Name);
            sw.WriteLine();
            // Write the claimsets in the authorization context. By default, there is only one claimset
            // provided by the system. 
            foreach (ClaimSet claimset in ServiceSecurityContext.Current.AuthorizationContext.ClaimSets)
            {
                foreach (Claim claim in claimset)
                {
                    // Write out each claim type, claim value, and the right. There are two
                    // possible values for the right: "identity" and "possessproperty". 
                    sw.WriteLine("Claim Type = {0}", claim.ClaimType);
                    sw.WriteLine("\t Resource = {0}", claim.Resource.ToString());
                    sw.WriteLine("\t Right = {0}", claim.Right);
                }
            }
        }
    }
    

    Source: http://msdn.microsoft.com/en-us/library/aa347790.aspx

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

How can I tell if a method is running in the context of an
How do I tell my new employer that I can’t use the computer they gave me?
Can anyone tell me how I can display a status message like 12 seconds
Can you tell me what is the difference between abstraction and information hiding in
How can I tell from the assembly name, or assembly class (or others like
I can't tell from the Python documentation whether the re.compile(x) function may throw an
Can anyone tell me what is the memory usage overhead associated with PHP opcode
I have a tabbed application where I want the user to be able to
How do native speakers tell I’m foreign based on my English alone?
Could someone tell me what the units the SetTimeout(int) method in the ICriteria interface

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.