ApplyAutheticationTicket() public static méthode

public static ApplyAutheticationTicket ( WebServicesClientProtocol protocol, string userName, string password ) : void
protocol WebServicesClientProtocol
userName string
password string
Résultat void
        public static T GetService <T>() where T : WebServicesClientProtocol, new()
        {
            T serviceWse = new T
            {
                Url =
                    string.Format("{0}Services/{1}.asmx", SettingsManager.TargetProcessPath,
                                  typeof(T).Name),
                Credentials = TpAuthenticationManager.Instance.GetCredentials()
            };

            var password = TpAuthenticationManager.Instance.IsIntegrated &&
                           string.IsNullOrEmpty(TpAuthenticationManager.Instance.Password)
                                        ? TpAuthenticationManager.DEFAULT_PASSWORD_TEMPLATE
                                        : TpAuthenticationManager.Instance.Password;


            TpServicePolicy.ApplyAutheticationTicket(serviceWse, TpAuthenticationManager.Instance.UserName, password);
            return(serviceWse);
        }
Exemple #2
0
        public Exception Authenticate(string userName, string userPassword, bool isIntegrated, string processPath)
        {
            try
            {
                var wse = new AuthenticationService();

                wse.Credentials = GetCredentials(isIntegrated, userName, userPassword);
                wse.Url         = processPath + "Services/AuthenticationService.asmx";
                if (isIntegrated && string.IsNullOrEmpty(userPassword))
                {
                    userPassword = DEFAULT_PASSWORD_TEMPLATE;
                }
                TpServicePolicy.ApplyAutheticationTicket(wse, userName, userPassword);
                wse.Authenticate();
            }
            catch (Exception exception)
            {
                return(exception);
            }

            return(null);
        }