-----------------------------------------------------------

New Message on MumbaiUserGroup

-----------------------------------------------------------
From: Saurabh_MSFT
Message 3 in Discussion

Hi !

"When we configure our web app. to use Windows authentication, ASP.NET attaches a 
WindowsPrincipal object to the request".  We can program our web app. to use this 
object for determining whether a requesting identity is in a given role or not.


The best and the easiest way could be :

Use the AUTH_USER server variable in your WindowsAuthentication_OnAuthenticate event 
to identify the user name or simple use User.Name to get the Name of the user.

OR 

For your case, you only need to verify the role of the user by  using :
If User.IsInRole("Admin") Then
  ApplyADMIN()
ElseIf User.IsInRole("Guest") 
  ApplyGuest()
Else
  'Invalid User.

End If

And if your interested in customize the security. Then you must design your own class 
that implements System.Security.Principal.IPrincipal.

Example:





Public Class MyPrincipal : Inherits IPrincipal
  ' Implement application-defined role mappings
End ClassNow open your global.asax:

Public Sub WindowsAuthentication_OnAuthenticate(Source As Object, e As 
WindowsAuthenticationEventArgs)
  ' Attach a new application-defined class that implements IPrincipal to
  ' the request.
  ' Note that since IIS has already performed authentication, the provided
  ' identity is used.
  e.User = New MyPrincipal(e.Identity)
End Sub




 

Hope this helps you in clearing your doubt. In case not, you can revert on the same.



take care...

Regards,
Saurabh Verma
Machrotech (India) Pvt. Ltd.
Contact : 09850228788

Microsoft India Community Star
MCT.NET, MCSD.NET (EA), MCAD.NET, MCDBA
Send flowers & gifts. Valentine gift guide. At MSN Shopping. 

-----------------------------------------------------------

To stop getting this e-mail, or change how often it arrives, go to your E-mail 
Settings.
http://groups.msn.com/mumbaiusergroup/_emailsettings.msnw

Need help? If you've forgotten your password, please go to Passport Member Services.
http://groups.msn.com/_passportredir.msnw?ppmprop=help

For other questions or feedback, go to our Contact Us page.
http://groups.msn.com/contact

If you do not want to receive future e-mail from this MSN group, or if you received 
this message by mistake, please click the "Remove" link below. On the pre-addressed 
e-mail message that opens, simply click "Send". Your e-mail address will be deleted 
from this group's mailing list.
mailto:[EMAIL PROTECTED]

Reply via email to