小编Md.*_*lam的帖子

表单身份验证slidingExpiration不起作用

我有以下代码

int intTimeout = (FormsAuthentication.Timeout.Hours * 60) +
  FormsAuthentication.Timeout.Minutes;
var authTicket = new FormsAuthenticationTicket(1, Utility.userCookie, DateTime.Now, 
  DateTime.Now.AddMinutes(intTimeout), true, cookieValue);

string strEncryptedTicket = HttpUtility.UrlEncode(FormsAuthentication.Encrypt(authTicket));
var authCookie = new HttpCookie(Utility.userCookie, strEncryptedTicket);
authCookie.Expires = authTicket.Expiration;
//FormsAuthentication.RedirectFromLoginPage("", false);
authCookie.Secure = FormsAuthentication.RequireSSL;
//authCookie.Secure = true;

HttpContext.Current.Response.Cookies[Utility.userCookie].Expires = authTicket.Expiration;
HttpContext.Current.Response.Cookies[Utility.userCookie].Value = authCookie.Value;
Run Code Online (Sandbox Code Playgroud)

web.config下面

<authentication mode="Forms">
  <forms timeout="2" slidingExpiration="true" requireSSL="true" />
</authentication>
Run Code Online (Sandbox Code Playgroud)

我一直打到页面链接,它仍然会在2分钟后到期.

c# cookies asp.net-mvc form-authentication slidingexpiration

5
推荐指数
1
解决办法
943
查看次数

对 Firestore 文档的 Angular Firestore 查询

我有以下查询

    selectedUser$: AngularFirestoreDocument<any>;
    this.selectedUser$ = this.userCollection.ref.where('uid', '==', key)
Run Code Online (Sandbox Code Playgroud)

投掷错误

类型“查询”不可分配给类型“AngularFirestoreDocument”。“查询”类型中缺少属性“ref”。

我试过

this.selectedUser$ = this.userCollection.ref.where('uid', '==', key).get()
Run Code Online (Sandbox Code Playgroud)

没有成功

基本上,我希望查询返回 firestore 文档

angularfire2 angular google-cloud-firestore

5
推荐指数
2
解决办法
8349
查看次数

带有类对象的 Angular 7 行为主体

我有以下课程

export class filter {
    public PageRecords: number;
    public SearchText: string;
    public SortColumn: string = null;
    public SortDirection: string = null;
    public StartingPos: number;
}
Run Code Online (Sandbox Code Playgroud)

以下行为主题

filterParam = new BehaviorSubject(new filter);
Run Code Online (Sandbox Code Playgroud)

更新主题

this.filterParam.next(<filter>{StartingPos  : 1,PageRecords : 10 })
Run Code Online (Sandbox Code Playgroud)

当我得到主题的价值时

this.filterParam.value
Run Code Online (Sandbox Code Playgroud)

它只有我更新的两个道具开始位置和页面记录。它失去了其他道具。

如何解决这个问题?

observable rxjs behaviorsubject angular angular7

5
推荐指数
1
解决办法
6547
查看次数

在本机中在哪里使用后台地理位置服务

我才刚开始学习本机

我有

  • App.js
  • Navigation.js

我有两个屏幕

  • SplashScreen.js

  • Login.js

在App.js上

const App = () => (
  <Nav  />
);

export default App;
Run Code Online (Sandbox Code Playgroud)

Navigation.js

const Nav = createStackNavigator({
    loginScreen: { screen: Login },
    splashScreen: {screen: SplashScreen}
},
{ 
    initialRouteName: 'splashScreen',
})
export default createAppContainer(Nav);
Run Code Online (Sandbox Code Playgroud)

在splashscreen.js上

componentWillMount(){
    setTimeout(() => {
        this.props.navigation.navigate("loginScreen");
    }, 3000);
}
Run Code Online (Sandbox Code Playgroud)

到现在为止一切运转良好

现在,我开始使用以下方法实施后台地理位置跟踪

https://github.com/mauron85/react-native-background-geolocation/tree/0.4-stable

为了进行测试,我将其放置在login.js中

import React, { Component } from "react";
import Contacts from 'react-native-contacts';
import { Image, StyleSheet, Text, TouchableOpacity, View, Button, PermissionsAndroid } from "react-native";
import { appContainer, …
Run Code Online (Sandbox Code Playgroud)

background geolocation react-native react-native-android

5
推荐指数
1
解决办法
1012
查看次数

使用 C# 创建 WebAssembly

我浏览了下面的文章

https://medium.freecodecamp.org/get-started-with-web assembly-using-only-14-lines-of-javascript-b37b6aaca1e4

令人印象深刻的是,我们可以使用 Web Assembly 在 javascript 中使用 C++ 代码。

我们是否有任何选项可以使用 C# 创建此类 Web 程序集,我们可以在其中创建 Web 程序集并在 javascript 中使用,例如 Angular 或 React。

经历过

https://learn.microsoft.com/en-us/aspnet/core/client-side/spa/blazor/get-started?view=aspnetcore-3.0&tabs=visual-studio

但这看起来不像创建一个可以通过导入在单独的仅角度项目中使用的程序集

谢谢

javascript c# webassembly

5
推荐指数
1
解决办法
2150
查看次数

序列化列表时显示 JSON 中的索引值

我有一个包含项目列表的类。当我序列化该类时,我希望项目索引值出现在 JSON 中。

我正在使用以下代码转换为 JSON:

var json = Newtonsoft.Json.JsonConvert.SerializeObject(imp);
Run Code Online (Sandbox Code Playgroud)

现在我得到的输出如下所示:

{
    "userdata":{
        "name":"name",
        "type":"type",
        "company_name":"company_name"
    },
    "f_item":null,
    "o_item":null,
    "attributes":[
        {
            "firstval":"0",
            "name":"at 0",
            "opposite_name":"opname 0"
        },
        {
            "firstval":"1",
            "name":"at 1",
            "opposite_name":"opname 1"
        },
        {
            "firstval":"2",
            "name":"at 2",
            "opposite_name":"opname 2"
        },
        {
            "firstval":"3",
            "name":"at 3",
            "opposite_name":"opname 3"
        },
        {
            "firstval":"4",
            "name":"at 4",
            "opposite_name":"opname 4"
        }
    ],
    "eos":null
}
Run Code Online (Sandbox Code Playgroud)

我需要这样的输出:

{
    "userdata":{
        "name":"name",
        "type":"type",
        "company_name":"company_name"
    },
    "f_item":null,
    "o_item":null,
    "attributes":{
        "0": {
            "firstval":"0",
            "name":"at 0",
            "opposite_name":"opname 0"
        },
        "1": {
            "firstval":"1",
            "name":"at 1", …
Run Code Online (Sandbox Code Playgroud)

c# json json.net

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

DynamoDb 使用排序键删除

我在发电机 dB 表中有以下字段

event_on—— 字符串类型

user_id -- 数字类型

事件名称——字符串类型

由于该表可能有多个 user_id 记录,而 event_on 是可以唯一的单个字段,因此我将其设为主键,并将 user_id 作为排序键

现在我想删除一个用户的所有记录,所以我的代码是

response = dynamodb.delete_item(
            TableName=events,
            Key={
                "user_id": {"N": str(userId)}
            })
Run Code Online (Sandbox Code Playgroud)

它抛出错误

发生异常调用DeleteItem操作时发生错误(ValidationException):提供的键元素与架构不匹配

还有无论如何要删除的范围

有人可以建议我应该如何处理 dynamodb 表结构才能使此代码正常工作

谢谢,

amazon-dynamodb boto3 aws-lambda

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

角材料多选获取隐藏的选定值

设想 :

  • 我有一个多选的角度材料过滤器

去做 :

  • 我想在隐藏下拉列表时获取选定的值..

    我用谷歌搜索并试图找到文档,但找不到任何将隐藏事件添加到 miltiselect 的参考

multi-select material-design angular-material angular

3
推荐指数
1
解决办法
4121
查看次数

文件中的多个架构不起作用

我在单个 schema.js 文件中有两个架构

var mongoose = require('mongoose');  

var user = new mongoose.Schema({
  name: String,
  add: String,
  role: String
});

var Organizationn = new mongoose.Schema({
  name: String,
  add: String,
  name:String
});

module.exports = {
  user: user,
  Organizationn: Organizationn
};
Run Code Online (Sandbox Code Playgroud)

访问它就像

var models = require("../models/schema");
models.user.findOne()
Run Code Online (Sandbox Code Playgroud)

它说 findone 不是一个函数

而如果我在文件中使用单用户,则它正在工作。

我已经浏览了这个链接并像上面那样导出

声明多个模式后无法从数据库中获取数据(mongoose + express + mongodb

但不工作

任何的想法?

谢谢

在@anthony 的帮助下,我找到了问题所在

我需要做以下

module.exports = {
  user: mongoose.model('user', user),,
  Organizationn: mongoose.model('Organizationn', Organizationn)
};
Run Code Online (Sandbox Code Playgroud)

mongoose mongodb node.js express

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

隐藏一些垫子选项角度实现

我可以看到隐藏了属性,但是当我尝试它的属性时它不起作用

<mat-option 
  *ngFor="let item of itemlist" 
  [value]="item.Name" 
  [hidden]="true">
  <span>{{ item.Name }}</span>
</mat-option>
Run Code Online (Sandbox Code Playgroud)

但上面并没有隐藏。

我能做什么来隐藏它,我需要根据情况隐藏一些选项

请指教。

谢谢

materialize angular-material angular

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

c#中动态返回类型的函数

我有一个函数,如下所示:

private static *bool* Function()
{

if(ok)
return UserId; //string
else
return false; //bool

}
Run Code Online (Sandbox Code Playgroud)

有没有办法做到这一点?在stackoverflow中有一些像这样的问题,但我无法理解.

c# c#-4.0

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

json中的单个字符串反序列化c#

我在JSON中有以下字符串

string IDS = "{\"IDS\":\"23,24,25,28\"}"
Run Code Online (Sandbox Code Playgroud)

现在我需要将其转换为c#字符串

我试过这个

string id = new JavaScriptSerializer().Deserialize<string>(IDS);
Run Code Online (Sandbox Code Playgroud)

我想在字符串中找回这个逗号分隔的字符串,但它会抛出错误

没有为'System.String类型定义无参数构造函数

有什么帮助怎么办?

谢谢

c# json deserialization json-deserialization

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