如何限制访问网页为不同类型的用户? [英] How to restrict access to web pages for different types of users?

查看:126
本文介绍了如何限制访问网页为不同类型的用户?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个Web应用程序,其中有一个管理员和许多用户。当他一个用户登录被带到某一页而他可以执行哪些导致他限制在他的其他页面。同样也适用于管理员太等操作。但是,如果我运行时用户可以访问管理员的页面,反之亦然期间更改的URL限制页面。我听说过使用成员访问。但我不知道如何做。我使用那里的登录信息被存储在一个表中的SQL数据库。

I have a web application where there is one admin and many users. When a user logs in he is taken to a certain page from which he can perform other operations which lead him to other pages restricted to him .The same goes for the admin too. But if i change the url to the restricted page during runtime a user can access an admin's page and vice versa. I have heard about using membership access. But i dont know how its done. I am using an sql database where the login details are stored in a table.

让我怎么限制访问?我听说它做的web.config中的东西吗?是否有可能通过使用来实现同样的结果只是code后面?

So how do i restrict access? I have heard it has to do something with the web.config? Is it possible to achieve the same result by using just code behind?

推荐答案

在加载页面,你可能要检查用户是否有正确的权限,并允许访问或重定向他到另一个页面。

When loading your pages, you might have to check if the user have the right permission and allow access or redirect him to another page.

如果!用户可以访问网页{
   重定向
}

If ! user can access page { redirect }

您网页的内容。

这篇关于如何限制访问网页为不同类型的用户?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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