小编Ame*_*een的帖子

如何在ServiceStack中注销经过身份验证的用户?

为noob问题道歉.刚刚开始学习servicestack.我正在使用Razor的自托管控制台应用程序作为我的视图引擎,注册的"RegistrationFeature"插件和CredentialsAuthProvider通过表单发布以允许用户登录进行身份验证.

SocialBootStrap应用程序使用MVC 3,并做了"FormsAuthentication.SignOut()",以允许用户注销.鉴于我正在使用自托管应用程序,我创建了一个LogoutService,它只执行Request.RemoveSession()并且看起来有效.

这是注销用户会话的正确方法吗?

servicestack

14
推荐指数
2
解决办法
4272
查看次数

使用HttpClient和RightScale API

我正在尝试将WCF Rest Starter Kit与RightScale的Login API一起使用,这看起来相当简单.

编辑-这里有一个博客条目我就使用PowerShell来使用API写道.

编辑 - 为RightScale API创建通用.NET包装器 - NRightAPI

它与使用CURL时的外观完全一样简单.为了让我获得一个登录cookie,我需要做的是:

curl -v -c rightcookie -u username:password" https://my.rightscale.com/api/acct/accountid/login?api_version=1.0 "

我收到以下cookie:

HTTP/1.1 204否内容日期:
2009 年12月25 日星期五 12:29:24 GMT服务器:Mongrel 1.1.3状态:204否内容X-Runtime:0.06121
内容类型:text/html; charset = utf-8
内容长度:0
缓存控制:无缓存
为域my.rightscale.com添加cookie _session_id ="488a8d9493579b9473fbcfb94b3a7b8e5e3",路径/,到期0
Set-Cookie:_session_id = 488a8d9493579b9473fbcfb94b3a7b8e5e3; 路径= /; 安全变化:接受编码

但是,当我使用以下C#代码时:

HttpClient http = new HttpClient(" https://my.rightscale.com/api/accountid/login?api_version=1.0 ");
http.TransportSettings.UseDefaultCredentials = false;
http.TransportSettings.MaximumAutomaticRedirections = 0;
http.TransportSettings.Credentials = new NetworkCredential("username","password");
Console.WriteLine(http.Get()Content.ReadAsString());

而不是HTTP 204,我得到一个重定向:

您正在<a> href ="https://my.rightscale.com/dashboard">重定向<a>

如何使用RighScale API获取WCF REST入门套件?

rest powershell wcf cloud-hosting rightscale

4
推荐指数
1
解决办法
1513
查看次数

标签 统计

cloud-hosting ×1

powershell ×1

rest ×1

rightscale ×1

servicestack ×1

wcf ×1