如何应用asp.net授权在两个不同的文件夹? [英] How to apply the asp.net authorization in two different folders?
问题描述
我在我的asp.net网站的两个文件夹,即供应商和系统管理员
I have two folders in my asp.net website namely VENDORS and ADMIN
我要当任何用户访问任何直到他们登录其重定向到管理员/ login.aspx的Admin文件夹内的页面....
i want when any user access any of the page inside the ADMIN folder it redirects to Admin/login.aspx until they login ....
我希望在页面的厂商内部的任何用户访问任何文件夹重定向到供应商/ login.aspx的,直到他们登录....
i want when any user access any of the page inside the VENDORS folder it redirects to Vendors/login.aspx until they login ....
如何做到这一点使用的web.config授权....
How to do that using web.config authorization ....
推荐答案
您需要有管理员的内部web.config文件中,并分别厂商文件夹。独立元素,这些内部web.config文件中,你将宣布你的< formsauthentication过夜。全球web.config中不应该包含
< formsauthentication方式>
元素
You need to have web.config files inside the admin and vendors folder separately. Inside these web.config files you would declare your <formsauthentication>
elements independently. The global web.config should contain no <formsauthentication>
element.
编辑:
我公司将提供XML片段下方,但实施FormsAuthentication是不是我推荐的人谁是初学者的任务。首先,你应该阅读和理解参与实施至少基本FormsAuthentication模型进程一>。话虽这么说,这将是根据相关的web.config条目&LT;&的System.Web GT;
部分:
I will provide a xml snippet below, but implementing FormsAuthentication is not a task I would recommend for someone who is a beginner. First you should read and understand the process involved in implementing at least a basic FormsAuthentication model. That being said, this would be the relevant web.config entry under the <system.web>
section:
<authentication mode="Forms">
<forms loginUrl="~/vendors/login.aspx"
protection="All"
timeout="30"
name=".ASPXAUTH"
requireSSL="false"
slidingExpiration="false"
defaultUrl="~/vendors/default.aspx"
cookieless="UseDeviceProfile"/>
</authentication>
这篇关于如何应用asp.net授权在两个不同的文件夹?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!