.Net roles in a Windows App

Discussion in 'ASP .Net Security' started by Gerhard, Feb 16, 2007.

  1. Gerhard

    Gerhard Guest

    Hi,

    I have a Windows Application that I am successfully using
    Membership.ValidateUser to validate a user against the same database I use
    for the Web App part of the system. My question is, how do I use the role
    based security similiar to IsInRole function that is available in a Web App
    through HttpContext.Current.User in my Windows Application?

    Thanks.
     
    Gerhard, Feb 16, 2007
    #1
    1. Advertising

  2. Hi,

    You may create your customized User class by implementing IPrincipal to
    instead of HttpContext.Current.User, and you can use the provider also in
    WinForms - use app.config instead. Reference system.web.dll and copy the
    relevant entries from your web.config to the app.config file.

    Sincerely,

    Luke Zhang

    Microsoft Online Community Support
    ==================================================
    Get notification to my posts through email? Please refer to
    http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
    ications.

    Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
    where an initial response from the community or a Microsoft Support
    Engineer within 1 business day is acceptable. Please note that each follow
    up response may take approximately 2 business days as the support
    professional working with you may need further investigation to reach the
    most efficient resolution. The offering is not appropriate for situations
    that require urgent, real-time or phone-based interactions or complex
    project analysis and dump analysis issues. Issues of this nature are best
    handled working with a dedicated Microsoft Support Engineer by contacting
    Microsoft Customer Support Services (CSS) at
    http://msdn.microsoft.com/subscriptions/support/default.aspx.
    ==================================================

    This posting is provided "AS IS" with no warranties, and confers no rights.
     
    Luke Zhang [MSFT], Feb 19, 2007
    #2
    1. Advertising

  3. Gerhard

    Gerhard Guest

    Thanks. Is there any sample code to show how to implement IPrincipal in
    VB.Net in this way?

    "Luke Zhang [MSFT]" wrote:

    > Hi,
    >
    > You may create your customized User class by implementing IPrincipal to
    > instead of HttpContext.Current.User, and you can use the provider also in
    > WinForms - use app.config instead. Reference system.web.dll and copy the
    > relevant entries from your web.config to the app.config file.
    >
    > Sincerely,
    >
    > Luke Zhang
    >
    > Microsoft Online Community Support
    > ==================================================
    > Get notification to my posts through email? Please refer to
    > http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
    > ications.
    >
    > Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
    > where an initial response from the community or a Microsoft Support
    > Engineer within 1 business day is acceptable. Please note that each follow
    > up response may take approximately 2 business days as the support
    > professional working with you may need further investigation to reach the
    > most efficient resolution. The offering is not appropriate for situations
    > that require urgent, real-time or phone-based interactions or complex
    > project analysis and dump analysis issues. Issues of this nature are best
    > handled working with a dedicated Microsoft Support Engineer by contacting
    > Microsoft Customer Support Services (CSS) at
    > http://msdn.microsoft.com/subscriptions/support/default.aspx.
    > ==================================================
    >
    > This posting is provided "AS IS" with no warranties, and confers no rights.
    >
    >
    >
    >
     
    Gerhard, Feb 19, 2007
    #3
  4. Hello,

    I didn't find a exactly matched example, but you may take a look at this
    one:

    http://msdn2.microsoft.com/en-us/library/aa302401.aspx

    Even it is for web application, you can still use some code and idea in it.

    Sincerely,

    Luke Zhang

    Microsoft Online Community Support
    ==================================================
    Get notification to my posts through email? Please refer to
    http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
    ications.

    Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
    where an initial response from the community or a Microsoft Support
    Engineer within 1 business day is acceptable. Please note that each follow
    up response may take approximately 2 business days as the support
    professional working with you may need further investigation to reach the
    most efficient resolution. The offering is not appropriate for situations
    that require urgent, real-time or phone-based interactions or complex
    project analysis and dump analysis issues. Issues of this nature are best
    handled working with a dedicated Microsoft Support Engineer by contacting
    Microsoft Customer Support Services (CSS) at
    http://msdn.microsoft.com/subscriptions/support/default.aspx.
    ==================================================

    This posting is provided "AS IS" with no warranties, and confers no rights.
     
    Luke Zhang [MSFT], Feb 20, 2007
    #4
  5. Gerhard

    Gerhard Guest

    Thanks. That handled it for me.

    Have a happy day.

    "Luke Zhang [MSFT]" wrote:

    > Hello,
    >
    > I didn't find a exactly matched example, but you may take a look at this
    > one:
    >
    > http://msdn2.microsoft.com/en-us/library/aa302401.aspx
    >
    > Even it is for web application, you can still use some code and idea in it.
    >
    > Sincerely,
    >
    > Luke Zhang
    >
    > Microsoft Online Community Support
    > ==================================================
    > Get notification to my posts through email? Please refer to
    > http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
    > ications.
    >
    > Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
    > where an initial response from the community or a Microsoft Support
    > Engineer within 1 business day is acceptable. Please note that each follow
    > up response may take approximately 2 business days as the support
    > professional working with you may need further investigation to reach the
    > most efficient resolution. The offering is not appropriate for situations
    > that require urgent, real-time or phone-based interactions or complex
    > project analysis and dump analysis issues. Issues of this nature are best
    > handled working with a dedicated Microsoft Support Engineer by contacting
    > Microsoft Customer Support Services (CSS) at
    > http://msdn.microsoft.com/subscriptions/support/default.aspx.
    > ==================================================
    >
    > This posting is provided "AS IS" with no warranties, and confers no rights.
    >
    >
    >
    >
     
    Gerhard, Feb 20, 2007
    #5
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. tom
    Replies:
    4
    Views:
    14,281
    jpowers5882
    Oct 24, 2008
  2. John Stockton
    Replies:
    2
    Views:
    392
    Bruce Barker
    Oct 12, 2005
  3. dcbud
    Replies:
    6
    Views:
    2,974
  4. Scott M.

    Windows App v. ASP.Net App

    Scott M., Mar 20, 2006, in forum: ASP .Net
    Replies:
    4
    Views:
    497
    Garth Wells
    Mar 21, 2006
  5. Jéjé
    Replies:
    0
    Views:
    260
    Jéjé
    Sep 27, 2005
Loading...

Share This Page