Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class AuthHeader : SoapHeader
- {
- public string Username;
- public string Password;
- }
- public class Service1 : System.Web.Services.WebService
- {
- public AuthHeader Authentication; ** where does visual studio append value to proxy
- [SoapHeader("Authentication", Required = true)]
- [WebMethod]
- public string security()
- {
- if (Authentication.Username == "test" &&
- Authentication.Password == "test")
- {
- return "authenticated";
- }
- else
- {
- return "get lost";
- }
- }
- static void Main(string[] args)
- {
- ServiceReference1.AuthHeader auth = new ServiceReference1.AuthHeader();
- auth.Username = "test";
- auth.Password = "test";
- ServiceReference1.Service1SoapClient ser = new ServiceReference1.Service1SoapClient();
- ser.AuthHeaderValue = auth; ** does not reconise authheadervalue
- String message = ser.security();
- Console.WriteLine(message);
- }
- WebService service = new WebService();
- service.Authentication.Username = "a";
- service.Authentication.Password = "a";
- string str = service .CheckAuthn();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement