Click here to Skip to main content
15,890,512 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have a vb.net class I am using in C# for AD authentication. My problem is its not able to read my properites for the user in C#. What would be the properway to fix it in VB.NET to make it seen or can someone provide an example in C# of how I could rewrite it?

Its a VB.NET class but it seems to access most if not all but can't seem to retrieve the _theUser. It's always null even though I can access the ADSecurity.UserCredentials class and view some the items in the Class. Could it also be that maybe Session is not being populated? Meaning Session["thisUser"]is not defined or defined correctly?

Public ReadOnly Property UserId() As String
Get
Return _userId
End Get
End Property
The following C# is where it can't see the user properties and comes back with _theUser as null.

protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{

_theUser = (ADSecurity.UserCredentials)Session["thisUser"];
if (_theUser.IsValidUser)
{
if (_theUser.IsAdminGroup | _theUser.IsManagersGroup | _theUser.IsProjManagersGroup | _theUser.IsProduction | _theUser.IsSales | _theUser.IsFlight | _theUser.IsSupport)
{


}
Posted
Updated 4-Dec-09 16:29pm
v2

You might want to look at where the file containing the class is. Visual Studio makes assumptions about language depending on what it finds in a directory.
 
Share this answer
 
Well, reference to the dll and add the namespace. The C# class will act just the same in VB.NET.

You dont need to convert C# code to vb.net as both of them produces same IL.

If a property cant be seen, then the access specifier used when defining the property is not enough. ;)
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900