locked
Custom role provider in a console application RRS feed

  • Question

  • Hello,

    I have written a role provider which assumes Windows authentication and so far works well with WCF services and ASP.NET. Is it possible to use it also with a console/WPF/WinForm applications? I tried a configuration like this on a very simple console app but the Initialize method of the provider doesn't even get called. Below is my app.config. Thanks in advance.

    <configuration>
        <system.web>
            <authentication mode="Windows" />
            <roleManager enabled="true"
                         defaultProvider="Authorization.RoleProvider">
                <providers>
                    <clear/>
                    <add name="Authorization.RoleProvider"
                         type="Authorization.RoleProvider, Authorization.RoleProvider"
                         applicationName="urn:AuthorizationDemo:Program"
                         authorizationServiceUrl="net.pipe://localhost/Authorization/Authorization.svc"/>
                </providers>
            </roleManager>
        </system.web>
    </configuration>


    Thanks Val

    Tuesday, May 21, 2013 5:10 PM

All replies

  • Hi Val,

    Thank for posting on MSDN Forum.

    For a console application or Winforms application, please take a look at this similar thread: http://stackoverflow.com/questions/2905407/how-to-use-windows-authentication-in-windows-application 

    Your above config file is dedicated for asp.net application. 

    Thanks.

    Best regards,


    Mike Feng
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.


    • Edited by Mike Feng Wednesday, May 22, 2013 1:57 PM
    Wednesday, May 22, 2013 1:36 PM
  • I am sorry but the pointed article is about authentication which I do not have a problem with. I am asking about authorization by using role provider (not membership provider) and PrincipalPermission. Thanks anyway.

    Valo


    Thanks Val

    Wednesday, May 22, 2013 7:21 PM
  • I am sorry but the pointed article is about authentication which I do not have a problem with. I am asking about authorization by using role provider (not membership provider) and PrincipalPermission. Thanks anyway.

    Valo


    Thanks Val

    Hi Val,

    I am trying to involve some other into this case, it will take some times, thank you for your patience.

    Best regards,


    Mike Feng
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Thursday, May 23, 2013 12:22 PM
  • Hi,

    You can get take a look on these articles:

    - http://msdn.microsoft.com/en-us/library/bb384297.aspx

    - http://stackoverflow.com/questions/444230/can-you-use-the-asp-net-membership-provider-in-a-windows-application


    Regards,
    Christian HL
    Microsoft Online Community Support


    Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.

    Friday, May 24, 2013 6:40 AM
  • Christian,

    Thanks for the reply. The links that you sent me use the client application services. However in my case there is no asp.net application to leverage off of. Since my role provider is quite thin I was hoping to attach it directly to the console application in a manner that client services does. After all they are using a role provider that forwards to the actual asp.net provider, right?

    If I cannot make it work I guess I would have to put it in some empty asp.net app and use it via client services...

    Thanks
    Val


    Thanks Val

    Friday, May 24, 2013 7:51 PM
  • Hi Val:

    If you need to implement authorization, have a look at the following article based on role security:

    http://msdn.microsoft.com/en-us/library/ms233780(v=vs.100).aspx


    Best regards,
    Riquel

    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Thursday, May 30, 2013 8:17 PM