コード例 #1
0
        public HttpResponseMessage GetAuthToken(string usrname, string password)

        {
            ServiceClass _ServiceClass = new ServiceClass();
            var          token         = _ServiceClass.GenereteToken(usrname, password);
            var          response      = Request.CreateResponse(HttpStatusCode.OK, "Autherized");

            response.Headers.Add("Token", token.AuthToken);
            response.Headers.Add("TokenExpiry", DateTime.Now.AddHours(2).ToString());
            response.Headers.Add("Acess Control Expose Header", "token, token expiry");
            return(response);
        }