简体   繁体   中英

How I can make that users from a Active Directory Folder can see a webform in my ASP.NEt Application?

I have built a ASP.NET Application that is for Guestconnection and this have a navigation with

  • Add User
  • Log
  • Help

This Application will be run in our intranet (sharepoint) and I want that only user from a folder in active directory (for example guestadmin) see the navigation log.

Here is my master site:

...
<div class="cssmenu" id='cssmenu'>
                    <ul>
                       <li class='active'><a href='UserList.aspx'><span>Benutzer</span></a></li>    
                        <% if (true)
                          { %>    
                          <li><a href='log.aspx'><span>Aufzeichnung</span></a></li>               

                       <% } %>                 
                       <li ><a href='help.aspx'><span>Hilfe</span></a></li>
                    </ul>
                 </div>
...

If the authen.. user is in this ad folder than I want to get true else false.

我想这可以通过使用目录服务来完成,您可以在活动目录中搜索用户,然后执行所需的操作。尝试使用名称空间活动目录目录服务

Take a look at the Role Provider . There are a few implementations, including WindowsTokenRoleProvider .

Here are the basic web.config/system.web settings:

<authentication mode="Windows" />

<authorization>
  <allow roles="BUILTIN\Administrators" />
    <deny users="*" />
  </authorization>

<roleManager defaultProvider="WindowsProvider" 
  enabled="true"
  cacheRolesInCookie="false">
  <providers>
    <add
      name="WindowsProvider"
      type="System.Web.Security.WindowsTokenRoleProvider" />
  </providers>
</roleManager>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM