Link to home
Start Free TrialLog in
Avatar of csalle01
csalle01

asked on

ASP.NET MVC Works in Local Visual Studio Server NullReferenceException on IIS

I am developing a small asp.net mvc intranet application for our company.  Right now the home page will get the Windows username from the windows logged on user and make a call to our active directory based on that username to get more detailed info about the user (email, ect.)

Everything works great on my local Visual Studio 2008 server.  But when I deploy all the files to my IIS 6.0 server I get the following:

[NullReferenceException: Object reference not set to an instance of an object.]
   STPIntranet.MvcApplication.Session_Start() in C:\Documents and Settings\csallemi\My Documents\Visual Studio 2008\Projects\STPIntranet\STPIntranet\Global.asax.cs:50

[TargetInvocationException: Exception has been thrown by the target of an invocation.]


   System.RuntimeMethodHandle._InvokeMethodFast(Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner) +0
   System.RuntimeMethodHandle.InvokeMethodFast(Object target, Object[] arguments, Signature sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner) +71
   System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks) +350
   System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) +29
   System.Web.Util.ArglessEventHandlerProxy.Callback(Object sender, EventArgs e) +42
   System.Web.SessionState.SessionStateModule.RaiseOnStart(EventArgs e) +8779824
   System.Web.SessionState.SessionStateModule.CompleteAcquireState() +237
   System.Web.SessionState.SessionStateModule.BeginAcquireState(Object source, EventArgs e, AsyncCallback cb, Object extraData) +504
   System.Web.AsyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +66
   System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +155

It is failed in my Global.asax.cs file where I try to populate a custom User object (has a username and email property). In line 50 where the error is occuring I make a call to a class called SecurityUtil to get the theusername from WindowsIdentity.GetCurrent(); and get the email by making a call into our active directory.

I almost want to say that the necessary libraries are not getting added in either my project dll or web.config file because of the null pointer.

Please help. I'm running out of ideas.

Avatar of csalle01
csalle01

ASKER

Another thing I am concerned with is the error line :
C:\Documents and Settings\csallemi\My Documents\Visual Studio 2008\Projects\STPIntranet\STPIntranet\Global.asax.cs:50 is pointing to my local file structure and not my local iis directory path.
ASKER CERTIFIED SOLUTION
Avatar of csalle01
csalle01

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial