使用Owin cookie身份验证时遇到一个奇怪的问题.
当我启动我的IIS服务器时,身份验证在IE/Firefox和Chrome上运行得非常好.
我开始使用身份验证进行一些测试并在不同的平台上登录,我想出了一个奇怪的错误.偶尔Owin框架/ IIS只是不向浏览器发送任何cookie.我将输入一个用户名和密码,该代码运行正确,但根本没有cookie传递给浏览器.如果我重新启动服务器它开始工作,那么在某些时候我将尝试登录并再次cookie停止交付.单步执行代码不会做任何事情并且不会抛出任何错误.
app.UseCookieAuthentication(new CookieAuthenticationOptions
{
AuthenticationMode = AuthenticationMode.Active,
CookieHttpOnly = true,
AuthenticationType = "ABC",
LoginPath = new PathString("/Account/Login"),
CookiePath = "/",
CookieName = "ABC",
Provider = new CookieAuthenticationProvider
{
OnApplyRedirect = ctx =>
{
if (!IsAjaxRequest(ctx.Request))
{
ctx.Response.Redirect(ctx.RedirectUri);
}
}
}
});
Run Code Online (Sandbox Code Playgroud)
在我的登录程序中,我有以下代码:
IAuthenticationManager authenticationManager = HttpContext.Current.GetOwinContext().Authentication;
authenticationManager.SignOut(DefaultAuthenticationTypes.ExternalCookie);
var authentication = HttpContext.Current.GetOwinContext().Authentication;
var identity = new ClaimsIdentity("ABC");
identity.AddClaim(new Claim(ClaimTypes.Name, user.Username));
identity.AddClaim(new Claim(ClaimTypes.NameIdentifier, user.User_ID.ToString()));
identity.AddClaim(new Claim(ClaimTypes.Role, role.myRole.ToString()));
authentication.AuthenticationResponseGrant =
new AuthenticationResponseGrant(identity, new AuthenticationProperties()
{
IsPersistent = isPersistent
}); …
Run Code Online (Sandbox Code Playgroud) 我创建了一个自定义组件,我放在一个for循环中,例如
<div *ngFor="let view of views">
<customcomponent></customcomponent>
</div>
Run Code Online (Sandbox Code Playgroud)
其输出将是:
<customcomponent></customcomponent>
<customcomponent></customcomponent>
<customcomponent></customcomponent>
Run Code Online (Sandbox Code Playgroud)
我想知道当这些组件的数量可以变化时,如何使用@viewchild语法或任何其他方法来获取对这些组件的引用
当组件可以给出一个名称,例如
<customcomponent #compID></customcomponent>
Run Code Online (Sandbox Code Playgroud)
我可以参考如下:
@ViewChild('compID') test: CustomComponent
Run Code Online (Sandbox Code Playgroud)
如果不是这种情况,我如何引用它,例如可能使用索引?
(此问题与使用ElementRef无关,因为之前已经提到的其他问题可以通过下面列出的答案看到)此问题涉及访问多个@ViewChild和使用列表查询.
我正在使用momentjs并使用moment.hour(xx)moment.minute(xx)操纵日期.
当我在console.log中看到对象包含_d和_i时:_d包含正确更改的moment.hour()或moment.minute()但是_i对象包含原始对象?
k {_isAMomentObject: true, _i: Thu Dec 11 2014 20:34:00 GMT+0200 (South Africa Standard Time), _isUTC: false, _pf: Object, _locale: j…}
_d: Thu Dec 11 2014 14:00:00 GMT+0200
_i: Thu Dec 11 2014 20:34:00 GMT+0200
Run Code Online (Sandbox Code Playgroud)
谁能开导我?
我想完全关闭Site.Mobile.Master页面.我的网站是响应式的,我希望移动浏览器使用相同的母版页.
我如何在ASP.NET友好的URL中执行此操作
谢谢
我奋力调用像typeahead.js功能val
,open
,close
,等.
typeahead在输入元素上正常工作,因为它显示条目但是当我尝试调用任何typeahead函数时,我收到此错误:
Uncaught Error: one of local, prefetch, or remote is requiredmessage: "one of local, prefetch, or remote is required
Run Code Online (Sandbox Code Playgroud)
我的初始化代码如下:
var currentMedicalAid;
var medicalAidList = $('#medicalAidList');
var medicalAidengine = new Bloodhound({
datumTokenizer: Bloodhound.tokenizers.obj.whitespace('MedicalAid1'),
queryTokenizer: Bloodhound.tokenizers.whitespace,
limit: 5,
prefetch: {
url: '/api/Search/GetMedicalAidList',
}
});
medicalAidengine.initialize();
medicalAidList.typeahead(null, {
name: 'MedicalAid1',
displayKey: 'MedicalAid1',
// `ttAdapter` wraps the suggestion engine in an adapter that
// is compatible with the typeahead jQuery plugin
source: medicalAidengine.ttAdapter()
}).blur(function () { …
Run Code Online (Sandbox Code Playgroud) 我真的在与铁路由器waitOn挣扎.
我有很多订阅,我想等待,在我看来铁路由器正在等待任何事情.
我已经设置了许多订阅(main.js),我想在应用程序启动之前加载它:
Meteor.subscribe("appointments");
Meteor.subscribe("business");
Meteor.subscribe("clients");
Meteor.subscribe("staff");
Run Code Online (Sandbox Code Playgroud)
我已经尝试了几乎所有可能的配置,但我似乎无法让"加载器"显示自己并等待所有订阅准备就绪.我在layoutTemplate('layout')中有一个辅助函数来从数据库中获取一个值但是findOne()返回undefined/null我认为这是因为路由器没有等待订阅...
我的路由器配置.我想了解我如何链接依赖项或创建依赖项等待.
Router.configure({
layoutTemplate: 'layout',
loadingTemplate: 'loading',
waitOn: function () {
console.log('Iron router start');
this.subscribe('clients').wait();
this.subscribe('staff').wait();
this.subscribe('appointments').wait();
this.subscribe('business').wait();
this.subscribe('calendar').wait();
},
action: function() {
if (this.ready()) {
this.render('dashboard');
} else {
this.render('loading');
}
}
});
Run Code Online (Sandbox Code Playgroud) asp.net ×2
angular ×1
friendly-url ×1
iron-router ×1
javascript ×1
katana ×1
meteor ×1
momentjs ×1
owin ×1
typeahead.js ×1