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

  • SEARCH
  • Home
  • 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 7810757
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T03:54:25+00:00 2026-06-02T03:54:25+00:00

I have a C# project that references a .NET assembly built from a VB.NET

  • 0

I have a C# project that references a .NET assembly built from a VB.NET project.

This VB.NET assembly requires administrative rights.

I’ve created a manifest in my C# project with:

<requestedExecutionLevel level="requireAdministrator" uiAccess="false" />

and all seems good: when I run:

bool isAdmin = new WindowsPrincipal(WindowsIdentity.GetCurrent())
  .IsInRole(WindowsBuiltInRole.Administrator) ? true : false;

from my C# code, I get isAdmin == True as expected, but when I call a method from the VB.NET DLL with:

My.User.IsInRole(Microsoft.VisualBasic.ApplicationServices.BuiltInRole.Administrator)

I get False instead.

This seems very illogical to me.

Furthermore, if I create a VB.NET project with a reference to this VB.NET assembly and run it with admin rights, all works well.

  • 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-06-02T03:54:27+00:00Added an answer on June 2, 2026 at 3:54 am

    There’s a Note in the MSDN article for My.User that could be significant:

    For Windows applications, only projects built on the Windows Application template initialize the My.User object by default. In all other Windows project types, you must initialize the My.User object by calling the My.User.InitializeWithWindowsUser Method explicitly or by assigning a value to CurrentPrincipal.

    Don’t hesitate to skip My.User and use the C# approach instead.

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

Sidebar

Related Questions

I have a .NET project which references another assembly that is built outside of
I have an ASP.NET VB.NET web project that references a VB.NET class library. I
I have a website project. It has assembly references to external DLLs that we
I have a .NET project that's always been built/run by/on 32 bit machines. I
I have a .net project that has a web reference to a service. I
I have a class library project that references the version 4.1 Microsoft.Practices.Common dll. I
I have a VS2005 project that contains a couple web service references. The project
I have a Browser Helper Object project in c# that (obviously) references shdocvw.dll. I
I have a Project A that references System.Web.Mvc with CopyLocal=TRue. System.Web.Mvc is in the
I have a project built with .NET 4.0. I have a lot of code

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.