如何在 ASP.NET 页面中以编程方式生成 401 错误 [英] How to generate an 401 error programmatically in an ASP.NET page
本文介绍了如何在 ASP.NET 页面中以编程方式生成 401 错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如您所见,这是来自非 Web 开发人员的问题.我想要一个 ASPX 页面,在某些情况下,它可以从代码生成 401 错误.理想情况下,它将显示 IIS 标准页面.
As you can see this is a question from a non web developer. I would like to have an ASPX page which, under certain circumstances, can generate a 401 error from code. Ideally it would show the IIS standard page.
推荐答案
Set Response.StatusCode 然后 - 如果您需要停止执行 - 调用 Response.End().
Set Response.StatusCode and then - if you need to stop execution - call Response.End().
这篇关于如何在 ASP.NET 页面中以编程方式生成 401 错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文