当前位置: 首页>>代码示例>>C#>>正文


C# CommunicationHelper.ExecuteMethodReturnCookie方法代码示例

本文整理汇总了C#中CommunicationHelper.ExecuteMethodReturnCookie方法的典型用法代码示例。如果您正苦于以下问题:C# CommunicationHelper.ExecuteMethodReturnCookie方法的具体用法?C# CommunicationHelper.ExecuteMethodReturnCookie怎么用?C# CommunicationHelper.ExecuteMethodReturnCookie使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CommunicationHelper的用法示例。


在下文中一共展示了CommunicationHelper.ExecuteMethodReturnCookie方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: LoginAsync

        /// <summary>
        /// Authenticates a user based on the specified user id and password hash.
        /// </summary>
        /// <param name="UserId">The id for a specific user</param>
        /// <param name="PasswordHash">The password hash for the user</param>
        /// <param name="Extras">A comma separated string of additional attributes to return in the response</param>
        /// <returns>Login (AccountStatus, AccountType, FileSizeLimit, SessionID, SmugVault, User (id, DisplayName, NickName, URL))</returns>
        public async Task<MyUser> LoginAsync(int UserId, string PasswordHash, string Extras)
        {
            CommunicationHelper ch = new CommunicationHelper();
            // APIKey [required], Callback, Extras, PasswordHash [required], Pretty, Sandboxed, Strict, UserID [required]

            var tuple = await ch.ExecuteMethodReturnCookie<LoginResponse>("smugmug.login.withHash", null, "UserID", UserId, "PasswordHash", PasswordHash, "Extras", Extras);
            var resp = tuple.Item1;
            string su = tuple.Item2;
            if (resp.stat == "ok")
            {
                MyUser u = new MyUser();
                resp.Login.PopulateUser(u);
                u.basic._su = su;
                return u;
            }
            else
            {
                Console.WriteLine(resp.message);
                throw new SmugMugException(resp.code, resp.message, resp.method);
            }
        }
开发者ID:mesika,项目名称:mono-smugmug,代码行数:28,代码来源:Site.cs


注:本文中的CommunicationHelper.ExecuteMethodReturnCookie方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。