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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T15:06:17+00:00 2026-05-23T15:06:17+00:00

My web app compiles and runs fine on my machine. However when I publish

  • 0

My web app compiles and runs fine on my machine. However when I publish it to my IIS6 server, I get the infamous Object reference not set to an instance of an object. With the following stack trace

[NullReferenceException: Object reference not set to an instance of an object.]
   ForYourInformation.LDAPDetails..ctor(IntPtr logonToken) in d:\documents\documents\visual studio 2010\Projects\ForYourInformation\ForYourInformation\Utils.cs:66
   ForYourInformation._Default.Page_Load(Object sender, EventArgs e) in d:\documents\documents\visual studio 2010\Projects\ForYourInformation\ForYourInformation\Default.aspx.cs:24
   System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +24
   System.Web.UI.Control.LoadRecursive() +70
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +3047

The flagged file Utils.cs is as follows

_UserName = windowsId.Name.Substring(windowsId.Name.IndexOf('\\') + 1);
        _DomainName = windowsId.Name.ToString().Remove(windowsId.Name.IndexOf('\\'));

        //Get users information from active directory
        DirectorySearcher search = new DirectorySearcher("LDAP://DCHS");
        search.Filter = String.Format("(SAMAccountName={0})", _UserName);
        SearchResult result = search.FindOne();
        DirectoryEntry entry = result.GetDirectoryEntry();

        _FullName = result.Properties["givenName"][0].ToString() + ' ' + result.Properties["sn"][0].ToString();
        _Email = result.Properties["mail"][0].ToString();
        _FirstName = result.Properties["givenName"][0].ToString();
        _SSID = windowsId.User.ToString();

It goes and grabs the users active directory and security info. Line 66 is the DirectoryEntry line. I’ve got no idea whats going on here, since it works fine running locally.

Any help is appreciated thanks.

  • 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-23T15:06:18+00:00Added an answer on May 23, 2026 at 3:06 pm

    Here you go Matt, the result is return null. Check it out before you using it.

        SearchResult result = search.FindOne();
        if(result != null)
        {
           DirectoryEntry entry = result.GetDirectoryEntry();
    

    How to tell from the report. In this line it tell you that the 66 line throw the first error, and its a null pointer. So in this line the only null can be the result, and here we go, you find it.

    ForYourInformation.LDAPDetails..ctor(IntPtr logonToken) in d:\documents\documents\visual studio 2010\Projects\ForYourInformation\ForYourInformation\Utils.cs:66

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

Sidebar

Related Questions

Our web app needs to be made PCI compliant, i.e. it must not store
My web app runs on .Net 3.5, all of the dates are saved on
I am trying to get a simple web app to run on Mono and
i created an asp.net web app and it works fine with the compiler. i
I have an app that is run from a compiled DLL on a web
My web app is going to call a webservice. I'm looking for best practices
A web app I'm working on requires frequent parsing of diverse web resources (HTML,
My web App prepares out of a db for one or two minutes a
My web app solution consists of 3 projects: Web App (ASP.NET MVC) Business Logic
My web app has been chugging along just great in Production for years with

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.