小编San*_*zky的帖子

如何在.net框架中等于.net核心中的密码

我目前正在将使用.Net Framework 4.5.2的旧API迁移到.Net Core 2.1,在使用.Net Framework 4.5.2的旧API中有以下脚本:

PasswordHasher hasher = new PasswordHasher();
password = ConfigurationManager.AppSettings["userDefaultPassword"].ToString();
hashedPassword = hasher.HashPassword(password);
Run Code Online (Sandbox Code Playgroud)

所以我想知道,是否有任何相同的功能,我可以在.Net Core 2.1中使用,产生与旧.Net框架相同的哈希结果?

.net c# .net-core asp.net-core-2.0

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

在 IIS 上上传文件时出现 ASP.NET Core API 500 内部服务器错误

我正在开发一个 API 项目,该项目需要上传文件的功能。当我在 localhost 上运行该项目并尝试上传文件时,它工作得很好,但是当我发布该项目并将其部署在 IIS 上时,上传功能不起作用并产生 500 内部服务器错误。

    [Authorize]
[Route("api/[controller]")]
[ApiController]
public class UserFilesController : ControllerBase
{
    private IConfiguration configuration;

    public UserFilesController(IConfiguration iConfig)
    {
        configuration = iConfig;
    }

    [HttpPost]
    public async Task<IActionResult> PostFormData([FromForm]IFormFile file)
    {
        var dict = new Dictionary<string, string>();
        HttpContext.User.Claims.ToList()
           .ForEach(item => dict.Add(item.Type, item.Value));

        string userid = dict.ElementAt(2).Value;

        FileConverter fileConverter = new FileConverter();

        if (file == null || file.Length == 0)
            return Content("file not selected");

        var path = Path.Combine(
                    Directory.GetCurrentDirectory(), "File",
                    file.FileName);

        string ext = Path.GetExtension(file.FileName);
        string …
Run Code Online (Sandbox Code Playgroud)

c# iis asp.net-core asp.net-core-webapi

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

即使 Android 设备已连接,React Native run-android 也始终启动模拟器

我是 React Native 的新手,在运行命令 npm react-native run-android 时遇到这个问题,它总是启动模拟器,即使我的 Android 设备已连接并在运行命令时显示在 adb 设备列表中adb devices

我的环境:
操作系统:Windows 10
NPM:6.14.4
节点:v10.21.0

android npm android-studio react-native metro-bundler

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