Hi
I followed this tutorial https://www.guru99.com/security-web-services.html to add basic authentication to an asmx webservice running under https (read only data).
In short i added
public class AuthHeader : SoapHeader{public string UserName;public string Password;}
My method is surrounded with
[SoapHeader("Credentials")]
and the method includes
if (Credentials.UserName == "username") && (Credentials.Password == "password"){// Get Data}
When i run the service in a browser i see
POST /MyServices.asmx HTTP/1.1Host: localhostContent-Type: text/xml; charset=utf-8Content-Length: lengthSOAPAction: "http://tempuri.org/GetData"
<?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Header><AuthHeader xmlns="http://tempuri.org/"><UserName>string</UserName><Password>string</Password></AuthHeader></soap:Header><soap:Body><GetData xmlns="http://tempuri.org/" /></soap:Body></soap:Envelope>
I would like to use Fiddler to retrieve the data, so i create the POST request and the soap:Envelope to the header but it returns no data (probably due to the username/password not sent correctly).
I then read up on clicking Tools > Text Wizard to enter the username and password in the format myusername:password which showed the value in BASE64 added
Authentication: Basic BASE64StringForUsernamePassword
but again this didnt work (again probably due to me doing something wrong).
Does anyone know how i could send a request using Fiddler with a username and password? Or have i missed something somewhere else?