小编Pat*_*fer的帖子

UWP UnauthorizedException

我目前正在编写我的第一个UWP应用程序,只是为了学习绳索.我正在构建一个小应用程序,从下载的facebook-archive中提取数据.

但是当我尝试打开文件时(即使每个人都有完全访问权限),我收到了UnauthorizedException.我不明白这一点,我没有发现任何人只有任何旧文件有这个问题(有很多人遇到更具体的情况问题,但不只是他们的硬盘上的简单文件)

System.UnauthorizedAccessException was unhandled by user code
  HResult=-2147024891
  Message=Access to the path 'C:\Users\patri\Downloads\facebook-100004420950389\html\messages.htm' is denied.
  Source=System.IO.FileSystem
  StackTrace:
       at System.IO.WinRTIOExtensions.<TranslateWinRTTaskCore>d__1`1.MoveNext()
    --- End of stack trace from previous location where exception was thrown ---
       at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
       at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
       at System.IO.WinRTFileSystem.<OpenAsync>d__1.MoveNext()
    --- End of stack trace from previous location where exception was thrown ---
       at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
       at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
       at System.IO.WinRTFileSystem.Open(String fullPath, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options, FileStream parent)
       at System.IO.FileStream.Init(String path, FileMode mode, …
Run Code Online (Sandbox Code Playgroud)

.net c# visual-studio windows-runtime uwp

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

OWIN作为IdentityServer4的受众

我的组织使用IdentityServer4作为单点登录提供程序进行承载身份验证。

我们还有许多用.NET Framework 4.6和OWIN编写的服务。在OWIN Web API中从IdentityServer4验证令牌的“正确”方法是什么?

我找到了可与OWIN一起使用的NuGet-Package IdentityServer3.AccessTokenValidation。但是据我所知,IdentityServer4.AccessTokenValidation包似乎仅可用于ASP.NET Core。

我是否必须通过IdentityServerBearerTokenValidationMiddleware类手动配置验证?还是有更好的解决方案?

asp.net owin identityserver4

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

GetEnumSelectList 在 RazorPages 中生成一个空的组合框

我用 ASP.NET Core 开始了一个新项目,但遇到了以下问题:

当我尝试从枚举中填充选择列表时,我只得到一个空的组合框......我使用 .NET Core 2.0 和 Razor Pages。

我已经用我想要开始工作的部分的裸骨重建了我在实际项目中的代码。

枚举:

    namespace EnumTest2
{
    public enum SomeEnum
    {
        Test1,
        Test2,
        Test3
    }
}
Run Code Online (Sandbox Code Playgroud)

班上:

using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Threading.Tasks;

namespace EnumTest2
{
    public class SomeClass
    {
        [Required]
        public SomeEnum TheEnum { get; set; }
    }
}
Run Code Online (Sandbox Code Playgroud)

页面模型:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;

namespace EnumTest2.Pages
{
    public class IndexModel : PageModel
    {
        [BindProperty]
        public SomeClass TheClass { …
Run Code Online (Sandbox Code Playgroud)

asp.net razor

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