lundi 12 février 2018

User login via ASMX service inside ASP.NET MVC application

I'm new to web development and I'm trying to implement a web application that has two parts:

  1. WebApp front-end using ASP.NET MVC 5 where a user can manage data and configure certain items to be stored in a SQL Server database
  2. ASMX SOAP-based service which is called in order to perform various actions that a user has configured in the database. Unfortunately, this needs to remain a SOAP service as it deals with a 3rd party framework.

I'm getting more comfortable with MVC, but the web service side is throwing me off.

Right now, I'm utilizing ASP.NET Identity from the template MVC project (with some additional user properties) on the WebApp front end to allow a user to create an account and manage there data. This front-end interface is working well.

The issue I'm running into is when trying to authenticate a user via the SOAP ASMX service.

For example:

[WebMethod]
public string[] authenticate(string strUserName, string strPassword)
{
    var result = await HttpContext.Current.GetOwinContext().Get<ApplicationSignInManager>().PasswordSignInAsync(strUserName, strPassword, false, false);

    if (result == SignInStatus.Success)
    {
        // Do something useful
    }
}

At the sign-in line, execution just stops and returns. No debug information, no exception. I'll be honest I haven't fully grasped ASP.NET Identity yet nor the template provide in the MVC application, I'm learning slowly.

From the service perspective, if a user was logged in successfully other WebMethods would be called to access the SQL Server database and access that user's specific actions they've configured.

Alternatively, is there a better approach to implementing this SOAP web service in a MVC application? It seems to me that Web API only supports RESTful convention and therefore wouldn't work in my case.




Aucun commentaire:

Enregistrer un commentaire