.Net roles in a Windows App

G

Gerhard

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.
 
L

Luke Zhang [MSFT]

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.
 
G

Gerhard

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

Luke Zhang [MSFT]

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.
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top