0

I do not have any experience in working in asmx. The company I work in is trying to update their time entry site. It was built in using web service asmx and anyone with the url could access the time entry for it. Now they want to implement a basic authentication feature for it so anyone can't access it. After searching and trying out approaches of different blogs and stackoverflow questions I am now stuck and don't know how to approach the problem and don't understand the underlying principle in how the asmx service can perform basic authentication.

I tried this approach,

public class WebServiceAuthentication : AuthorizedWebService
{
    
    [WebMethod]
    [SoapHeader("Authentication", Direction = SoapHeaderDirection.In)]
    public string HelloWorld()
    {
        base.Authorize();
        return "Hello " + base.Authentication.Username;
        //return "Hello";
    }
}

Where authorizedWebService calling a database and authenticating username and password.

1
  • 1
    Most systems are moving from Windows Credentials to OAUTH2 because OAUTH2 works with Windows, Linux, and MAC. Make sure the server is using Windows and not OAUTH2. Also see learn.microsoft.com/en-us/dotnet/api/…
    – jdweng
    Commented Aug 22 at 13:58

0