通过直接复制url拒绝用户访问管理员页面 [英] Deny Users to acesss administrator pages by by direct copying url

查看:212
本文介绍了通过直接复制url拒绝用户访问管理员页面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好

我有一个要停止用户导航到管理员页面的应用程序,他们可以通过提供直接URL来对其进行访问.请问有什么机构可以帮助我.


我已经尝试了代码

Hi All

I have a application on which i want to stop the users to navigate to admin pages which they can access by giving direct url. can any body please to help me.


i already tried the code

<authentication mode="Forms">
      <forms loginUrl="~/default.aspx" defaultUrl="~/default.aspx"></forms>
    </authentication>





<location path="Admin_Pages">
    <system.web>
      <authorization>
        <allow users="admin_Pages"/>
        <deny users="*"/>
      </authorization>
    </system.web>
  </location>



在Web配置文件中.
但是现在实际用户也无法登录.单击登录按钮后,它们将重定向默认页面.



in web config file.
But now the actual users also can not logon. after clicking login button they are redirecting the default page.

推荐答案

您的登录URL应该是您的登录页面,而不是默认页面

You login url should be your login page not default page

<authentication mode="Forms">
      <forms loginUrl="~/login.aspx" defaultUrl="~/login.aspx"></forms>
    </authentication>




这是有关相同话题的文章的链接: ASP中的表单身份验证和授权.NET [ ^ ]




here is link to article talks about the same : Form authentication and authorization in ASP.NET[^]


如何使用会话...

http://dotnetguts.blogspot.in/2009/06/basics-of- session-in-aspnet.html [ ^ ]

ASP.NET会话管理内部 [ http://asp.net-tutorials.com/state/sessions/ [ http://msdn.microsoft.com/en-us/library/ms178581.aspx [ ^ ]

问候
Sebastian
What about using session...

http://dotnetguts.blogspot.in/2009/06/basics-of-session-in-aspnet.html[^]

ASP.NET Session Management Internals[^]

http://asp.net-tutorials.com/state/sessions/[^]

http://msdn.microsoft.com/en-us/library/ms178581.aspx[^]

Regards
Sebastian


在登录时使用会话.
并在注销或关闭窗口后清除会话.
并在page_load事件检查会话中.如果session为null,则重定向到登录页面.
use session at the time of login.
and after logout or Close the window clear the session.
and at page_load event check session. if session is null then redirect to the login pagae.


这篇关于通过直接复制url拒绝用户访问管理员页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆