English 中文(简体)
拒绝访问重定向
原标题:Access denied redirection

我使用角色/项目来限制用户访问某些网页,例如:

 <location path="Reporting.aspx">
    <system.web>
      <authorization>
        <allow roles="Admin, Manager" />
        <deny users="*" />
      </authorization>
    </system.web>
  </location>

我只是在想,我怎样才能重新引导那些无法进入我自己的Aspx页面的人,而不是无法进入默认访问的页面的人呢?

最佳回答

您甚至不需要为此编程解决方案。 您可以从您的网站配置中更改由于404个错误、拒绝的错误( 405? ) 等原因被重定向的页面。 您只需编辑 htaccess 文件, 指向您自己的页面 。

似乎他们把程序输入IIS的某样东西 也许值得调查一下

问题回答

您可以在 Web. config 中配置此功能, 例如 :

<customErrors defaultRedirect="ErrorPage.aspx" mode="On"> 
    <error statusCode="401" redirect="AccessDenied.aspx" />       
</customErrors>




相关问题
Anyone feel like passing it forward?

I m the only developer in my company, and am getting along well as an autodidact, but I know I m missing out on the education one gets from working with and having code reviewed by more senior devs. ...

How to Add script codes before the </body> tag ASP.NET

Heres the problem, In Masterpage, the google analytics code were pasted before the end of body tag. In ASPX page, I need to generate a script (google addItem tracker) using codebehind ClientScript ...

Transaction handling with TransactionScope

I am implementing Transaction using TransactionScope with the help this MSDN article http://msdn.microsoft.com/en-us/library/system.transactions.transactionscope.aspx I just want to confirm that is ...

System.Web.Mvc.Controller Initialize

i have the following base controller... public class BaseController : Controller { protected override void Initialize(System.Web.Routing.RequestContext requestContext) { if (...

Microsoft.Contracts namespace

For what it is necessary Microsoft.Contracts namespace in asp.net? I mean, in what cases I could write using Microsoft.Contracts;?

Separator line in ASP.NET

I d like to add a simple separator line in an aspx web form. Does anyone know how? It sounds easy enough, but still I can t manage to find how to do it.. 10x!

热门标签