Мое веб-приложение прекрасно работает на моем компьютере.Однако, когда я публикую его на своем сервере IIS6, я получаю печально известный Object reference not set to an instance of an object.
со следующей трассировкой стека
[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
. Файл Utils.cs помечен следующим образом:
_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идет и забирает у пользователей активный каталог и информацию о безопасности.Строка 66 - это строка DirectoryEntry.Я понятия не имею, что здесь происходит, так как он работает нормально на местном уровне.
Спасибо за помощь, спасибо.