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 6111617
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T14:39:03+00:00 2026-05-23T14:39:03+00:00

I am trying to build an application on our company’s intranet using ASP.NET and

  • 0

I am trying to build an application on our company’s intranet using ASP.NET and VB.NET.

Neither of these functions return anything once my application is published to IIS. They work fine in development (ie: pressing F5 I get my regular network username), but once published they return ” (an empty string).

HttpContext.Current.User.Identity.Name
Page.User.Identity.Name

I’m looking for something — anything — that will grab the current users login name. Please note that I CANNOT change these settings in my web.config, because of other functionality requirements.

    <authentication mode="Windows"/>

    <roleManager enabled="true" cacheRolesInCookie="true" defaultProvider="AspNetWindowsTokenRoleProvider" cookieName=".ASPXROLES" cookiePath="/" cookieTimeout="480" cookieRequireSSL="false" cookieSlidingExpiration="true" createPersistentCookie="false" cookieProtection="All" />

Nor can I change any IIS settings, to include the ‘Enable Anonymous User’ setting. Specs are cast in stone and I’d have to chop off my own leg (or head) to get them changed.

I would think there’s got to be a way to get the current logged in user’s name with my current configuration.

Any ideas?

Thanks,

Jason

  • 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-23T14:39:04+00:00Added an answer on May 23, 2026 at 2:39 pm

    Here’s what I found (somewhere), and ended up using. Hope it can help someone else out there!

    Public Shared Function Check_If_Member_Of_AD_Group(ByVal username As String, _
    ByVal grouptoCheck As String, _
    ByVal domain As String, _
    ByVal ADlogin As String, _
    ByVal ADpassword As String) _
    As Boolean
    
        Dim myDE As DirectoryEntry
        Dim EntryString As String
        Dim NumberOfGroups As Integer
        Dim tempString As String
    
    
        'Checks to see if the specified user is a member of the specified group
        Try
    
            'Setup the LDAP basic entry string.
            EntryString = "LDAP://" & domain
    
    
            'Make the group to check all lowercase (for matching)
            grouptoCheck = grouptoCheck.ToLower()
    
    
            'Use the correct overloaded function of DirectoryEntry
            If (ADlogin <> "" AndAlso ADpassword <> "") Then
                myDE = New DirectoryEntry(EntryString, ADlogin, ADpassword)
            Else
                myDE = New DirectoryEntry(EntryString)
            End If
    
    
            'Filter the directory searcher and get the group names
            Dim myDirectorySearcher As New DirectorySearcher(myDE)
            myDirectorySearcher.Filter = "sAMAccountName=" & username
            myDirectorySearcher.PropertiesToLoad.Add("MemberOf")
            Dim myresult As SearchResult = myDirectorySearcher.FindOne()
    
    
            'Get the number of groups, so they can be itereated
            NumberOfGroups = myresult.Properties("memberOf").Count() - 1
    
    
            While (NumberOfGroups >= 0)
                'Extract the group name from the result set of the index
                tempString = myresult.Properties("MemberOf").Item(NumberOfGroups)
                tempString = tempString.Substring(0, tempString.IndexOf(",", 0))
                tempString = tempString.Replace("CN=", "")
                tempString = tempString.ToLower()
                tempString = tempString.Trim()
    
                If (grouptoCheck = tempString) Then         'We got a winner
                    Return True
                End If
                NumberOfGroups = NumberOfGroups - 1
            End While
    
            Return False                                    'User is not in the specified group
    
    
    
        Catch ex As Exception
    
            Check_If_Member_Of_AD_Group = False             'If all else fails, don't authenticate
    
        End Try
    
    
    End Function
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to build my application for GoogleAppEngine using maven. I've added the following
I'm trying to build a application that has different kinds of users, I'm using
I'm trying to switch our build from CruiseControl.NET running a custom .msbuild file to
I am trying to automatically deploy our Java EE application from our build server
I've been trying to implement FitNesse tests for our C# application. I'm using the
I'm trying to build our web application automatically. I need to be able to
We're trying to build an application that will describe our price list. The price
I am trying to build an application to help our marketing team manage a
I am trying to build a web application to evaluate .Net code online (like
I'm trying to build a simple SIP application using JAIN SIP 1.2 and the

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.