小编Iza*_*ska的帖子

TortoiseGit恢复失败 - 无法恢复本地更改

当我在我的本地环境上做一些修改,比如删除文件或修改它们,在TortoiseGit中,我点击提交并尝试恢复我可以看到的更改和错误:

恢复失败:错误:无法统计刚刚写入的文件:没有这样的文件或目录

还有其他人经历过这个吗?它似乎是某种权限问题,但有时这可以通过重新启动计算机来解决.我想找到更可靠的解决方案.

git tortoisegit

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

如何在 Razor 页面中重定向到自定义 404 页面

我正在使用 ASP.NET Core 3.0 和 Razor Pages。我正在尝试手动从 Index.cshtml.cs 重定向到自定义 404 错误页面(我有一些导入,并且希望在出现数据问题时显示 404)。

启动.csenter code here

public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{
   if (env.IsDevelopment())
   {
       app.UseDeveloperExceptionPage();
   }
   else
   {
       app.UseExceptionHandler("/errors/Error500");
       app.UseStatusCodePagesWithReExecute("/errors/Error{0}");
       app.UseHsts();
   }
   ...
Run Code Online (Sandbox Code Playgroud)

}

我的 404 错误页面位于 /Errors/Status404.cshtml 中。当我运行应用程序并尝试直接转到 /Errors/Status404 时,页面正在按预期解析。

Index.cshtml.cs 以不同的方式尝试使其工作,不幸的是它们都没有按照我想要的方式工作 - 要么它不执行任何操作,要么它返回系统 404 页面而不是我的自定义 404 页面:

public class IndexModel : PageModel
    {
        public void OnGet()
        {
            HttpContext.Response.Clear();
            HttpContext.Response.StatusCode = 404;

            HttpContext.Response.Redirect("/Errors/Error404");

            return StatusCode(404); //tried to return IActionResult from OnGet()

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

我还尝试返回上面的 …

asp.net error-handling redirect .net-core asp.net-core

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