小编Ned*_*son的帖子

Windows Universal App必须在调试之前部署

如果我对我的Windows Universal App进行任何更改,我必须在我能够调试之前手动部署它.我的意思是断点不会被击中,因为它与符号不同步.

我有Visual Studio 2015及所有最新更新.

这是设计的吗?

无论如何在执行调试之前强制部署?

c# win-universal-app

12
推荐指数
1
解决办法
949
查看次数

与Owin和Nancy的Oauth认证

遵循本指南,使用Owin上的MVC 5进行外部身份验证 - 使用owinkatana的外部登录提供程序.

我已将以下内容添加到我的Owin Nancy应用程序中

Startup.cs -

app.Properties["Microsoft.Owin.Security.Constants.DefaultSignInAsAuthenticationType"] = "ExternalCookie";
app.UseCookieAuthentication(new CookieAuthenticationOptions
{
    AuthenticationType = "ExternalCookie",
    AuthenticationMode = Microsoft.Owin.Security.AuthenticationMode.Passive,
});

app.UseTwitterAuthentication(new TwitterAuthenticationOptions
{
    ConsumerKey = "mykey",
    ConsumerSecret = "mypass"
});
Run Code Online (Sandbox Code Playgroud)

LoginModule.cs(nancy模块)

Post["ExternalLogin"] = _ =>
{
    var provider = Request.Form.name;
    var auth = Context.GetAuthenticationManager();
    auth.Challenge(new AuthenticationProperties
    {
        RedirectUri = String.Format("/?provder={0}", provider)
    }, provider);
    return HttpStatusCode.Unauthorized;
};
Run Code Online (Sandbox Code Playgroud)

现在在挑战点,没有任何事情发生.它只显示一个空白页面,其中包含重定向的Url.我已经确认我可以按照MVC中的示例来使用它.有谁知道这部分的正确南希代码?

c# asp.net nancy owin katana

9
推荐指数
1
解决办法
2096
查看次数

在Owin,Katana和Nancy成功进行cookie身份验证后,重定向到ReturnUrl

我正在使用Owin,Katana和Nancy来托管一个带有身份验证所需部分的简单网站.注意我也在使用nuget包 - Nancy.MSOwinSecurity

app.UseCookieAuthentication(new CookieAuthenticationOptions
{
    AuthenticationType = Constants.AuthenticationType,
    LoginPath = new PathString("/Login"),
});
app.UseNancy();
Run Code Online (Sandbox Code Playgroud)

这是我的模块代码

public class LoginModule : NancyModule
{
    public LoginModule()
    {
        Post["login"] = p =>
        {
            var name = Request.Form.name;
            var auth = Context.GetAuthenticationManager();
            var claims = new List<Claim> {new Claim(ClaimTypes.Name, name)};
            var id = new ClaimsIdentity(claims, Constants.AuthenticationType);
            auth.SignIn(id);
            // redirect how????
            return View["index"];
        };
    }
}
Run Code Online (Sandbox Code Playgroud)

我的提交表格

<form name="login" action="/login" method="post" accept-charset="utf-8">
    <ul>
        ...
    </ul>
</form>
Run Code Online (Sandbox Code Playgroud)

现在我想在成功登录ReturnUrl后重定向 -

例如登录?ReturnUrl =%2Fblah%2blahblah

似乎没有像表单身份验证那样的重定向方法,而且查询字符串参数属性为空.

c# authentication nancy owin katana

7
推荐指数
1
解决办法
7371
查看次数

尝试使用.netstandard 2程序集时,Web Api 2运行时错误

我有一个Asp.net WebApi 2网站引用.net 4.6.1.到目前为止,该网站引用了PCL程序集(便携式类库),与UWP和Xamarin兼容,没有任何问题.现在我正按照建议将该PCL更改为NetStandard2.0程序集,但在站点启动时收到错误.

错误如下 -

找不到方法:'System.Collections.ObjectModel.Collection`1 System.Web.Http.HttpConfiguration.get_MessageHandlers()'.

有任何想法吗?谢谢

c# asp.net asp.net-web-api .net-standard

2
推荐指数
1
解决办法
742
查看次数