小编GPS*_*ice的帖子

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

如何解决“未指定身份验证方案,并且未找到 DefaultChallengeScheme”的问题

[![消息错误]] [1]: https://i.stack.imgur.com/ciKCK.png

我的观点是,如果有人在没有登录的情况下进入授权页面,它将被重定向到登录页面。

这是我的代码(.NET Core 3.1):

我的控制器

    [Authorize]
    public IActionResult Username()
    {
        var lstUsername = _dbContext.MT_USERNAME.ToList();
        return View(lstUsername);
    }
Run Code Online (Sandbox Code Playgroud)

我的 Startup.cs

    public void ConfigureServices(IServiceCollection services)
    {
        services.AddDbContext<GPServiceDbContext>(options =>
        {
            options.UseSqlServer(xxx);
        });
        services.AddControllersWithViews();

        services.AddSession(options =>
        {
            options.IdleTimeout = TimeSpan.FromMinutes(1);   
        });
    }

    public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
    {
        if (env.IsDevelopment())
        {
            app.UseDeveloperExceptionPage();
        }
        else
        {
            app.UseExceptionHandler("/Home/Error");
            app.UseHsts();
        }
        app.UseHttpsRedirection();
        app.UseStaticFiles();
        app.UseRouting();
        app.UseAuthentication();
        app.UseStatusCodePages(context =>
        {
            var response = context.HttpContext.Response;
            if (response.StatusCode == (int)HttpStatusCode.Unauthorized ||
                response.StatusCode == (int)HttpStatusCode.Forbidden)
                response.Redirect("/Login/Login");
            return Task.CompletedTask; …
Run Code Online (Sandbox Code Playgroud)

c# asp.net-mvc .net-core visual-studio-code asp.net-core

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

BootstrapVue 访问槽模板中的 b 表行数据

我每行都有一个删除按钮,我需要log_id从 items 中获取数据以传递给 function deleteLog。该功能始终提醒的log_idundefined

如果没有 ,我如何传递log_id给函数?deleteLogundefined

<template>
    <b-table striped hover :items="items" :fields="fields">
        <template v-slot:cell(Delete)>
            <b-button variant="danger" v-on:click="deleteLog(log_id)">Delete</b-button>
        </template>
    </b-table>
</template>

<script>
export default {
    data() {
        return {
            fields: ['Year', 'Month', 'Round', 'Name', 'Delete', 'log_id'],
            items: []
        }
    }
}
</script>
Run Code Online (Sandbox Code Playgroud)

javascript vue.js vue-component vuejs2 bootstrap-vue

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