locked
ASP.NET Web API (VS 2017) and ASP.NET Webforms (VS 2013) - Single Sign On using Machinekey RRS feed

  • Question

  • User135423268 posted

    Good Day Everyone

    I have a project that is made in ASP.NET MVC (VS 2013) and ASP.NET Webforms, and they are publish on separate websites, then I made a single sign on for the two sites so If login to the webforms sites, I can automatically login to the MVC site, I use the <machineKey> for the single sign on.

    Now when we upgraded the ASP.NET MVC to ASP.NET Web API (VS 2017) then using the same machinekey, there we got a problem, there is an error shows when I successfully Log to the Webforms but having an error when I'm clicking the Web API site, this also happen when I Login to Web API site and having an error to the Webforms sites, see the error below.

    How can I solve this problem? those anyone encounter this? thanls

    [NullReferenceException: Object reference not set to an instance of an object.]
       ProjWebAPI_MyProject_2._0.HomeController.Index() in C:\Projects\Firm Applications\MyProject\Travel_New\ProjWebAPI_MyProject_2.0_NewVer\ProjWebAPI_MyProject_2.0\Controllers\HomeController.vb:8
       lambda_method(Closure , ControllerBase , Object[] ) +86
       System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext controllerContext, IDictionary`2 parameters) +228
       System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary`2 parameters) +34
       System.Web.Mvc.Async.AsyncControllerActionInvoker.<BeginInvokeSynchronousActionMethod>b__36(IAsyncResult asyncResult, ActionInvocation innerInvokeState) +38
       System.Web.Mvc.Async.WrappedAsyncResult`2.CallEndDelegate(IAsyncResult asyncResult) +69
       System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethod(IAsyncResult asyncResult) +41
       System.Web.Mvc.Async.AsyncInvocationWithFilters.<InvokeActionMethodFilterAsynchronouslyRecursive>b__3c() +71
       System.Web.Mvc.Async.<>c__DisplayClass45.<InvokeActionMethodFilterAsynchronouslyRecursive>b__3e() +387
       System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethodWithFilters(IAsyncResult asyncResult) +42
       System.Web.Mvc.Async.<>c__DisplayClass28.<BeginInvokeAction>b__19() +38
       System.Web.Mvc.Async.<>c__DisplayClass1e.<BeginInvokeAction>b__1b(IAsyncResult asyncResult) +188
       System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeAction(IAsyncResult asyncResult) +38
       System.Web.Mvc.Controller.<BeginExecuteCore>b__1d(IAsyncResult asyncResult, ExecuteCoreState innerState) +29
       System.Web.Mvc.Async.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult asyncResult) +68
       System.Web.Mvc.Controller.EndExecuteCore(IAsyncResult asyncResult) +52
       System.Web.Mvc.Async.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult asyncResult) +39
       System.Web.Mvc.Controller.EndExecute(IAsyncResult asyncResult) +38
       System.Web.Mvc.MvcHandler.<BeginProcessRequest>b__4(IAsyncResult asyncResult, ProcessRequestState innerState) +43
       System.Web.Mvc.Async.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult asyncResult) +68
       System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult) +38
       System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +602
       System.Web.HttpApplication.ExecuteStepImpl(IExecutionStep step) +195
       System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +128


    Tuesday, January 22, 2019 11:08 AM

All replies

  • User475983607 posted

    Web API does not have a UI.  How do you logon to Web API?   

    Tuesday, January 22, 2019 11:20 AM
  • User753101303 posted

    Hi,

    Unclear. Also you can have MVC, Web Forms and Web API in the same project if this is what you need from a design point of view.

    Strictly speaking for now you are trying to use an object which is null and more likely you should check the "HomeController.Index"  code to see which object could be null.

    Tuesday, January 22, 2019 11:53 AM