小编K7B*_*uoy的帖子

TypeError jQuery offset().top未定义

Firefox调试器显示了一个jQuery函数的TypeError,旨在当用户同时滚动和更新类时,将导航栏粘贴到页面顶部.

功能如下.

$(window).scroll(function() {
    if ($(".navbar").offset().top>30) {
        $(".navbar-fixed-top").addClass("sticky");
    }
    else {
        $(".navbar-fixed-top").removeClass("sticky");
    }
});
Run Code Online (Sandbox Code Playgroud)

产生的错误就是这个.

时间戳:31/01/2014 10:01:04

错误:TypeError:$(...).offset(...)未定义

我已经在SO上查找了类似的示例,但无法将结果转换为修复.任何帮助将不胜感激.

css jquery typeerror offset

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

使用别名表更新SQL仍会返回"表格不明确"错误

我试图运行以下更新,但运行到"表是模糊的"错误.

UPDATE dbo.cg
SET cg.column = gId.ID
FROM    dbo.a
        INNER JOIN dbo.cg as cId ON cId.[a] = dbo.a.[c]
        INNER JOIN dbo.cg as gId ON gId.[a] = dbo.a.[b];
Run Code Online (Sandbox Code Playgroud)

表dbo.a包含用于根据与同一表的关系更新cg中的值与不同列中的值的数据.它是一个自引用层次结构.

正如你所看到的,一切都是别名的,所以我有点困惑为什么这不会运行.

非常感谢您提供的任何帮助.

sql table-alias sql-update

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

如何在ASP.Net Core 1.1中使用Response.Cookies.Append()?

我正在尝试使用Cookie允许用户具有文化偏爱,将全球化添加到Intranet应用程序中。中间件已设置并正在运行,但是根据UI选择,我在附加到Cookie时遇到了问题。

该方法直接来自Asp.Net Core文档,如下所示:

public void ConfigureServices(IServiceCollection services)
{
    services.Configure<RequestLocalizationOptions>(
        options =>
        {
            var supportedCultures = new List<CultureInfo>
            {
            new CultureInfo("en-US"),
            new CultureInfo("en-GB"),
            new CultureInfo("fr-FR"),
            new CultureInfo("es-ES")
            };

            options.DefaultRequestCulture = new RequestCulture(culture: "en-GB", uiCulture: "en-GB");
            options.SupportedCultures = supportedCultures;
            options.SupportedUICultures = supportedCultures;
        });

    services.AddLocalization();
    services.AddMvc(config =>
    {
        var policy = new AuthorizationPolicyBuilder()
                         .RequireAuthenticatedUser()
                         .Build();
        config.Filters.Add(new AuthorizeFilter(policy));
    })
    .AddViewLocalization();

    services.AddSession(options => {
        options.CookieName = "Intranet";
    });
}

public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
{
    var locOptions = app.ApplicationServices.GetService<IOptions<RequestLocalizationOptions>>();
    app.UseRequestLocalization(locOptions.Value);

    app.UseSession();
    app.UseMvc(routes …
Run Code Online (Sandbox Code Playgroud)

c# globalization cookies asp.net-core-1.1

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

使用.Net Core中的Windows Authenticated app从SQL填充自定义声明

场景 - 使用SQL Server管理应用程序特定权限和扩展用户身份的Active Directory中的.Net Core Intranet应用程序.

迄今为止的成功 - 用户已通过身份验证,并且可以使用Windows声明(名称和组).Identity.Name可用于从具有扩展属性的数据库返回域用户模型.

问题和问题 - 我试图填充一个自定义声明属性"Id",并通过ClaimsPrincipal全局提供.到目前为止,我已经查看了ClaimsTransformation,但没有取得多大成功.在其他文章中,我已经读过你必须在登录之前添加声明,但这真的可以吗?这意味着完全依赖AD满足所有索赔,情况确实如此吗?

下面是我在HomeController中的简单代码.我正在访问数据库,然后尝试填充ClaimsPrincipal,然后返回域用户模型.我认为这可能是我的问题所在,但我是.net的授权新手,并努力让我的头脑索赔.

非常感谢所有的帮助

现行代码:

public IActionResult Index()
        {
            var user = GetExtendedUserDetails();
            User.Claims.ToList();
            return View(user);
        }

        private Models.User GetExtendedUserDetails()
        {
            var user = _context.User.SingleOrDefault(m => m.Username == User.Identity.Name.Remove(0, 6));
            var claims = new List<Claim>();

            claims.Add(new Claim("Id", Convert.ToString(user.Id), ClaimValueTypes.String));
            var userIdentity = new ClaimsIdentity("Intranet");
            userIdentity.AddClaims(claims);
            var userPrincipal = new ClaimsPrincipal(userIdentity);

            return user;
        }
Run Code Online (Sandbox Code Playgroud)

更新:

我已经注册了ClaimsTransformation

app.UseClaimsTransformation(o => new ClaimsTransformer().TransformAsync(o));
Run Code Online (Sandbox Code Playgroud)

并根据此github查询构建如下所示的ClaimsTransformer

https://github.com/aspnet/Security/issues/863

public class ClaimsTransformer : IClaimsTransformer
{
    private readonly …
Run Code Online (Sandbox Code Playgroud)

authorization claims-based-identity asp.net-core

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

从 json 对象数组中 vuetify v-select 选项

我正在尝试从 rest api json 响应中填充 vuetify v-select。下面是我到目前为止的代码。使用简单数组填充列表没有问题,但我很难设置 value 和 text 属性。

<template>
  <v-container fluid>
    <v-slide-y-transition mode="out-in">
       <v-layout column align-center>
        <v-select v-model="dbSelect" v-on:change="dbConnect()"  :items="dbOptions" single-line></v-select>
       </v-layout>
    </v-slide-y-transition>
  </v-container>
</template>

<script>
import axios from 'axios'

export default {
  name: 'HelloWorld',
  data () {
    return {
      dbSelect: '',
      dbOptions: [],
    }
  },
  mounted () {
    axios.get('http://localhost:5000/api/values')
      .then(r => {
        // var formatted = []
        for (let i = 0; i < r.data.length; i++) {
          this.dbOptions.push(r.data[i])
          // formatted[i] = { value: r.data[i].id, text: r.data[i].name …
Run Code Online (Sandbox Code Playgroud)

vue.js axios vuejs2 vuetify.js

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