locked
Windows Authentication - User Roles RRS feed

Answers

  • User1713851783 posted

    I enabled Windows Authentication

    I have no experience with Windows Authentication but maybe this article could help: How To: Use Windows Authentication in ASP.NET 2.0.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Saturday, May 18, 2013 3:41 AM
  • User-981963818 posted

    Hi Everyone and thanks for the suggestions. I'm sorry that I took so long to follow up.

    Here is what I decided to do with help from this link provided by GmGregorihttp://msdn.microsoft.com/en-us/library/ff647405.aspx. It seems to get the job done.

    In web.config:

          <roleManager enabled="true"
                 defaultProvider="AspNetWindowsTokenRoleProvider"/>

    In _PageStart file or in the file of your choosing:

       if(Roles.IsUserInRole(@"Domain\Username")) {
      // Perform restricted operation
      }
    else{
      Response.Redirect("~/AreaRestricted");
      }




    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, June 3, 2013 11:36 AM

All replies

  • User379720387 posted
    Put this at the top of the page inside the code brackets.

    WebSecurity
    .RequireRoles("youruserrolehere");
    Friday, May 17, 2013 2:07 PM
  • User-981963818 posted

    Thanks for the reply.

    When I tried that, I got this message.

    To call this method, the "Membership.Provider" property must be an instance of "ExtendedMembershipProvider".

    Friday, May 17, 2013 2:23 PM
  • User-1974948304 posted

    Greetings,

    looks like you have not  created roles. Open your database and verify that you have these three tables:
    webpages_UsersInRoles
    webpages_Roles
    webpages_Membership.

    Then verify that they are NOT empty. Finally, open your web.cofig file and verify that Windows Authentication is set to "Enabled".

    Like this:

    <authentication>

     <windowsAuthentication enabled="true" />

                </authentication>
     hope this helps
    yousaid


     

    Friday, May 17, 2013 4:59 PM
  • User1713851783 posted

    I enabled Windows Authentication

    I have no experience with Windows Authentication but maybe this article could help: How To: Use Windows Authentication in ASP.NET 2.0.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Saturday, May 18, 2013 3:41 AM
  • User-981963818 posted

    Hi Everyone and thanks for the suggestions. I'm sorry that I took so long to follow up.

    Here is what I decided to do with help from this link provided by GmGregorihttp://msdn.microsoft.com/en-us/library/ff647405.aspx. It seems to get the job done.

    In web.config:

          <roleManager enabled="true"
                 defaultProvider="AspNetWindowsTokenRoleProvider"/>

    In _PageStart file or in the file of your choosing:

       if(Roles.IsUserInRole(@"Domain\Username")) {
      // Perform restricted operation
      }
    else{
      Response.Redirect("~/AreaRestricted");
      }




    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, June 3, 2013 11:36 AM