Adam Harding

Hi

Need to convert my successful web service in vb to C# with no knowledge of C#, a challenge and a half!

Used a web site to transalte the bulk of it then planned to attack the remaining essues one-by-one. Got them all sorted bar the 33 errors I have saying

'Invalid token '(' in class, struct or interface member declaration'

My C# code is as follows

Code Snippet

using System;

using System.Data;

using System.Web;

using System.Web.Services;

using System.Web.Services.Protocols;

using System.Web.UI.Design;

using System.Xml;

[WebService(Namespace = "http://afdintranet/ADLookup")]

[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]

[

public class Service

{

[WebMethod()]

public object ADQuery(string SearchParameter, string SearchString, string Attribute)

{

AD_Lookup objADL = new AD_Lookup();

objADL.EnumerateSearch(SearchParameter, SearchString);

return objADL.GetAttribute(Attribute);

}

[WebMethod()]

AD_Lookup objADL = new AD_Lookup();

string usrCurrent = objADL.Get_sAMAccountName(My.Request.ServerVariables("LOGON_USER"));

//Get information about the user.

objADL.EnumerateSearch("sAMAccountName", usrCurrent);

//Search AD using the Account name of the current user.

string strGivenName = objADL.GetAttribute("givenName");

string strSN = objADL.GetAttribute("sn");

string strTitle = objADL.GetAttribute("title");

string strMail = objADL.GetAttribute("mail");

string strDepartment = objADL.GetAttribute("department");

DataSet dsUser = new DataSet("AD_Info");

DataTable dtUserInfo = new DataTable("User_Info");

DataRow drAttrib = dtUserInfo.NewRow();

dtUserInfo.Columns.Add("givenName");

dtUserInfo.Columns.Add("sn");

dtUserInfo.Columns.Add("title");

dtUserInfo.Columns.Add("mail");

dtUserInfo.Columns.Add("manager");

dtUserInfo.Columns.Add("department");

dtUserInfo.Columns.Add("description");

dtUserInfo.Columns.Add("distinguishedName");

drAttrib("givenName") = strGivenName;

drAttrib("sn") = strSN;

drAttrib("title") = strTitle;

drAttrib("mail") = strMail;

drAttrib("department") = strDepartment;

dtUserInfo.Rows.Add(drAttrib);

dsUser.Tables.Add(dtUserInfo);

return dsUser;

}

}

Just for info i have also included the VB Code below as well to give you an idea of how this came about.

Code Snippet

Imports System

Imports System.Data

Imports System.Web

Imports System.Web.Services

Imports System.Web.Services.Protocols

Imports System.Web.UI.Page

Imports System.Xml

<WebService(Namespace:="http://afdintranet/ADLookup")> _

<WebServiceBinding(ConformsTo:=WsiProfiles.BasicProfile1_1)> _

<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _

Public Class Service

<WebMethod()> _

Public Function ADQuery(ByVal SearchParameter As String, ByVal SearchString As String, ByVal Attribute As String)

Dim objADL As New AD_Lookup

objADL.EnumerateSearch(SearchParameter, SearchString)

Return objADL.GetAttribute(Attribute)

End Function

<WebMethod()> _

Public Function ADUserInfo() As DataSet

Dim objADL As New AD_Lookup

Dim usrCurrent As String = objADL.Get_sAMAccountName(My.Request.ServerVariables("LOGON_USER"))

'Get information about the user.

objADL.EnumerateSearch("sAMAccountName", usrCurrent) 'Search AD using the Account name of the current user.

Dim strGivenName As String = objADL.GetAttribute("givenName")

Dim strSN As String = objADL.GetAttribute("sn")

Dim strTitle As String = objADL.GetAttribute("title")

Dim strMail As String = objADL.GetAttribute("mail")

Dim strDepartment As String = objADL.GetAttribute("department")

Dim dsUser As DataSet = New DataSet("AD_Info")

Dim dtUserInfo As DataTable = New DataTable("User_Info")

Dim drAttrib As DataRow = dtUserInfo.NewRow()

dtUserInfo.Columns.Add("givenName")

dtUserInfo.Columns.Add("sn")

dtUserInfo.Columns.Add("title")

dtUserInfo.Columns.Add("mail")

dtUserInfo.Columns.Add("manager")

dtUserInfo.Columns.Add("department")

dtUserInfo.Columns.Add("description")

dtUserInfo.Columns.Add("distinguishedName")

drAttrib("givenName") = strGivenName

drAttrib("sn") = strSN

drAttrib("title") = strTitle

drAttrib("mail") = strMail

drAttrib("department") = strDepartment

dtUserInfo.Rows.Add(drAttrib)

dsUser.Tables.Add(dtUserInfo)

Return dsUser

End Function

End Class

I really hope someone can help me as this is driving me nuts!!

Many thanks Adam



Re: ASMX Web Services and XML Serialization Newbie C# programmer needing help

Mattias Sjogren

Code Snippet

[

public class Service

Get rid of the square bracket here.

Code Snippet

[WebMethod()]

AD_Lookup objADL = new AD_Lookup();

Between these lines it looks like you're missing the method signature:

Code Snippet

public DataSet ADUserInfo() {






Re: ASMX Web Services and XML Serialization Newbie C# programmer needing help

element109

Code Snippet

using System;

using System.Data;

using System.Web;

using System.Web.Services;

using System.Web.Services.Protocols;

using System.Web.UI;

using System.Xml;

[WebService(Namespace = "http://afdintranet/ADLookup")]

[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]

public class Service

{

System.Web.HttpRequest Request=new HttpRequest("filename","url","query");

[WebMethod()]

public void ADQuery(string SearchParameter, string SearchString, string Attribute)

{

AD_Lookup objADL = new AD_Lookup();

objADL.EnumerateSearch(SearchParameter, SearchString);

return objADL.GetAttribute(Attribute);

}

[WebMethod()]

public DataSet ADUserInfo()

{

AD_Lookup objADL = new AD_Lookup();

string usrCurrent = objADL.Get_sAMAccountName(Request.ServerVariables["LOGON_USER"]);

// Get information about the user.

objADL.EnumerateSearch("sAMAccountName", usrCurrent);

// Search AD using the Account name of the current user.

string strGivenName = objADL.GetAttribute("givenName");

string strSN = objADL.GetAttribute("sn");

string strTitle = objADL.GetAttribute("title");

string strMail = objADL.GetAttribute("mail");

string strDepartment = objADL.GetAttribute("department");

DataSet dsUser = new DataSet("AD_Info");

DataTable dtUserInfo = new DataTable("User_Info");

DataRow drAttrib = dtUserInfo.NewRow();

dtUserInfo.Columns.Add("givenName");

dtUserInfo.Columns.Add("sn");

dtUserInfo.Columns.Add("title");

dtUserInfo.Columns.Add("mail");

dtUserInfo.Columns.Add("manager");

dtUserInfo.Columns.Add("department");

dtUserInfo.Columns.Add("description");

dtUserInfo.Columns.Add("distinguishedName");

drAttrib["givenName"] = strGivenName;

drAttrib["sn"] = strSN;

drAttrib["title"] = strTitle;

drAttrib["mail"] = strMail;

drAttrib["department"] = strDepartment;

dtUserInfo.Rows.Add(drAttrib);

dsUser.Tables.Add(dtUserInfo);

return dsUser;

}

}





Re: ASMX Web Services and XML Serialization Newbie C# programmer needing help

Adam Harding

Thanks people

Only errorring on the five lines now so great work

Code Snippet

string strGivenName = objADL.GetAttribute("givenName");

string strSN = objADL.GetAttribute("sn");

string strTitle = objADL.GetAttribute("title");

string strMail = objADL.GetAttribute("mail");

string strDepartment = objADL.GetAttribute("department");

And even better it is all the same error:

Cannot implicitly convert type 'object' to 'string'. an explicit conversion exists (are you missing a cast )

Google'd it and solved that with

Code Snippet

string strGivenName = Convert.ToString(objADL.GetAttribute("givenName"));

This script now works and does not error but invoking the AD_Lookup results in a 404 web page and the following exception

Code Snippet

A first chance exception of type 'System.UriFormatException' occurred in System.dll

I am now not sure as to whether the code above is causing the problem or the other code below.

Code Snippet

using System.DirectoryServices;

using System.Data;

public class AD_Lookup

{

private SearchResult m_SearchResult;

public object GetAttribute(string Attribute)

{

return m_SearchResult.GetDirectoryEntry().Properties.Values;

}

public void EnumerateSearch(string SearchParameter, string SearchString)

{

DirectorySearcher objDS = new DirectorySearcher("(" + SearchParameter + "=" + SearchString + ")");

m_SearchResult = objDS.FindOne();

}

public string Get_sAMAccountName(string strLogonName)

{

return strLogonName.Substring(strLogonName.IndexOf("\\") + 1);

}

}

Anyone got any ideas





Re: ASMX Web Services and XML Serialization Newbie C# programmer needing help

Adam Harding

Debugging the service gives the following output, if it is of any help to anyone.

Code Snippet

'WebDev.WebServer.EXE' (Managed): Loaded 'C:\WINDOWS\assembly\GAC_32\mscorlib\2.0.0.0__b77a5c561934e089\mscorlib.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.

'WebDev.WebServer.EXE' (Managed): Loaded 'C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\WebDev.WebServer.EXE', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.

'WebDev.WebServer.EXE' (Managed): Loaded 'C:\WINDOWS\assembly\GAC_32\WebDev.WebHost\8.0.0.0__b03f5f7f11d50a3a\WebDev.WebHost.dll', No symbols loaded.

'WebDev.WebServer.EXE' (Managed): Loaded 'C:\WINDOWS\assembly\GAC_MSIL\System.Windows.Forms\2.0.0.0__b77a5c561934e089\System.Windows.Forms.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.

'WebDev.WebServer.EXE' (Managed): Loaded 'C:\WINDOWS\assembly\GAC_MSIL\System\2.0.0.0__b77a5c561934e089\System.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.

'WebDev.WebServer.EXE' (Managed): Loaded 'C:\WINDOWS\assembly\GAC_MSIL\System.Drawing\2.0.0.0__b03f5f7f11d50a3a\System.Drawing.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.

'WebDev.WebServer.EXE' (Managed): Loaded 'C:\WINDOWS\assembly\GAC_32\System.Web\2.0.0.0__b03f5f7f11d50a3a\System.Web.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.

'WebDev.WebServer.EXE' (Managed): Loaded 'C:\WINDOWS\assembly\GAC_MSIL\System.Configuration\2.0.0.0__b03f5f7f11d50a3a\System.Configuration.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.

'WebDev.WebServer.EXE' (Managed): Loaded 'C:\WINDOWS\assembly\GAC_MSIL\System.Xml\2.0.0.0__b77a5c561934e089\System.Xml.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.

'WebDev.WebServer.EXE' (Managed): Loaded 'C:\WINDOWS\assembly\GAC_MSIL\System.Web.RegularExpressions\2.0.0.0__b03f5f7f11d50a3a\System.Web.RegularExpressions.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.

'WebDev.WebServer.EXE' (Managed): Loaded 'C:\WINDOWS\assembly\GAC_MSIL\Microsoft.JScript\8.0.0.0__b03f5f7f11d50a3a\Microsoft.JScript.dll', No symbols loaded.

'WebDev.WebServer.EXE' (Managed): Loaded 'C:\WINDOWS\assembly\GAC_MSIL\CppCodeProvider\8.0.0.0__b03f5f7f11d50a3a\CppCodeProvider.dll', No symbols loaded.

'WebDev.WebServer.EXE' (Managed): Loaded 'C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\webservice1\56986b05\19a0dee7\App_Code.is3kacfe.dll', Symbols loaded.

'WebDev.WebServer.EXE' (Managed): Loaded 'C:\WINDOWS\assembly\GAC_MSIL\System.DirectoryServices\2.0.0.0__b03f5f7f11d50a3a\System.DirectoryServices.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.

'WebDev.WebServer.EXE' (Managed): Loaded 'C:\WINDOWS\assembly\GAC_32\System.Data\2.0.0.0__b77a5c561934e089\System.Data.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.

'WebDev.WebServer.EXE' (Managed): Loaded 'C:\WINDOWS\assembly\GAC_MSIL\System.Web.Services\2.0.0.0__b03f5f7f11d50a3a\System.Web.Services.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.

'WebDev.WebServer.EXE' (Managed): Loaded 'C:\WINDOWS\assembly\GAC_MSIL\System.Web.Mobile\2.0.0.0__b03f5f7f11d50a3a\System.Web.Mobile.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.

'WebDev.WebServer.EXE' (Managed): Loaded 'C:\WINDOWS\assembly\GAC_MSIL\System.ServiceModel\3.0.0.0__b77a5c561934e089\System.ServiceModel.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.

'WebDev.WebServer.EXE' (Managed): Loaded 'C:\WINDOWS\assembly\GAC_MSIL\SMDiagnostics\3.0.0.0__b77a5c561934e089\SMDiagnostics.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.

'WebDev.WebServer.EXE' (Managed): Loaded 'C:\WINDOWS\assembly\GAC_32\System.EnterpriseServices\2.0.0.0__b03f5f7f11d50a3a\System.EnterpriseServices.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.

'WebDev.WebServer.EXE' (Managed): Loaded 'C:\WINDOWS\assembly\GAC_MSIL\System.Runtime.Serialization\3.0.0.0__b77a5c561934e089\System.Runtime.Serialization.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.

'WebDev.WebServer.EXE' (Managed): Loaded 'C:\WINDOWS\assembly\GAC_MSIL\System.IdentityModel\3.0.0.0__b77a5c561934e089\System.IdentityModel.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.

'WebDev.WebServer.EXE' (Managed): Loaded 'A_92a85ef1_ee8b_448c_a63b_d319a2b1a64a', No symbols loaded.

'WebDev.WebServer.EXE' (Managed): Loaded 'M_92a85ef1_ee8b_448c_a63b_d319a2b1a64a', No symbols loaded.

'WebDev.WebServer.EXE' (Managed): Loaded 'C:\WINDOWS\assembly\GAC_MSIL\System.Design\2.0.0.0__b03f5f7f11d50a3a\System.Design.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.

'WebDev.WebServer.EXE' (Managed): Loaded 'C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\webservice1\56986b05\19a0dee7\App_Web_defaultwsdlhelpgenerator.aspx.cdcab7d2.ymilsnnm.dll', Symbols loaded.

'WebDev.WebServer.EXE' (Managed): Loaded 'p88ian7o', No symbols loaded.

A first chance exception of type 'System.UriFormatException' occurred in System.dll

When I compare this with the successful VB.NET Web service I see no difference apart from the exception at the end and the two lines with no symbols loaded. I know something is wrong but am not sure what it is or more importantly what to do about it.

Heres hoping it means something to someone.

Cheers Adam





Re: ASMX Web Services and XML Serialization Newbie C# programmer needing help

Figo Fei - MSFT

Hi, Adam

Does the VB code webservice work well

If so, my guess is some other settings differs from vb to C#, since the code in C# looks good.

Thanks






Re: ASMX Web Services and XML Serialization Newbie C# programmer needing help

Adam Harding

Ignore



Re: ASMX Web Services and XML Serialization Newbie C# programmer needing help

Adam Harding

Got it sorted now, I can definitely say that my code is throwing the exception as a result of these two lines from the debugging output.

Code Snippet

A first chance exception of type 'System.NullReferenceException' occurred in App_Code.nwmcz1fy.dll

This is the output line that relates to the dll

Code Snippet

C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\webservice1\56986b05\19a0dee7\App_Code.nwmcz1fy.dll', Symbols loaded.

This is the dll created by the other bit of script I am using called AD_Lookup.cs, I think, as this provides the references for AD_Lookup objADL to do the job.

Code Snippet

using System.DirectoryServices;

using System.DirectoryServices.ActiveDirectory;

using System.DirectoryServices.Protocols;

using System.Data;

public class AD_Lookup

{

private SearchResult m_SearchResult;

public object GetAttribute(string Attribute)

{

return m_SearchResult.GetDirectoryEntry().Properties;

}

public void EnumerateSearch(string SearchParameter, string SearchString)

{

DirectorySearcher objDS = new DirectorySearcher("(" + SearchParameter + "=" + SearchString + ")");

m_SearchResult = objDS.FindOne();

}

public string Get_sAMAccountName(string strLogonName)

{

return strLogonName.Substring(strLogonName.IndexOf("\\") + 1);

}

}

I am still no dab hand with C# so I am not sure if this is the cause of the error or not. Either way something is going wrong but I dont know how to find it!

Anyone help





Re: ASMX Web Services and XML Serialization Newbie C# programmer needing help

Adam Harding

OK Amend the last post I am fairly sure that the line that is casuing issue is this one

Code Snippet

string usrCurrent = objADL.Get_sAMAccountName("AUTH_USER");

In VB it is written as

Code Snippet

Dim usrCurrent As String = objADL.Get_sAMAccountName(My.Request.ServerVariables("AUTH_USER"))

Without the My NAmespace in C# I do not know where to go Anyone got any ideas





Re: ASMX Web Services and XML Serialization Newbie C# programmer needing help

Figo Fei - MSFT

Adam Harding wrote:

OK Amend the last post I am fairly sure that the line that is casuing issue is this one

Code Snippet

string usrCurrent = objADL.Get_sAMAccountName("AUTH_USER");

In VB it is written as

Code Snippet

Dim usrCurrent As String = objADL.Get_sAMAccountName(My.Request.ServerVariables("AUTH_USER"))

Without the My NAmespace in C# I do not know where to go Anyone got any ideas

What about

Code Snippet

string usrCurrent = objADL.Get_sAMAccountName(this.Request.ServerVariables["AUTH_USER"]);

Thanks






Re: ASMX Web Services and XML Serialization Newbie C# programmer needing help

Adam Harding

Figo Thanks

but "this" doesn't work for me for some unknown reason. What I have got working is the following:

Code Snippet

string usrCurrent = objADL.Get_sAMAccountName(HttpContext.Current.Request.ServerVariables["AUTH_USER"]);

My web service runs perfectly now returns some .XML data BUT, it only returns the Namespace of the data not the data itself such as

Code Snippet

<<User_Info diffgr:id="User_Info1" msdata:rowOrder="0" diffgr:hasChanges="inserted">

<<givenName>System.DirectoryServices.PropertyCollection</< FONT>givenName>

<<sn>System.DirectoryServices.PropertyCollection</< FONT>sn>

<<title>System.DirectoryServices.PropertyCollection</< FONT>title>

<<mail>System.DirectoryServices.PropertyCollection</< FONT>mail>

<<department>System.DirectoryServices.PropertyCollection</< FONT>department>

<<distinguishedName>System.DirectoryServices.PropertyCollection</< FONT>distinguishedName>

</< FONT>User_Info>

When it should be returning (which my VB.NET web service does)

Code Snippet

<<User_Info diffgr:id="User_Info1" msdata:rowOrder="0" diffgr:hasChanges="inserted">

<<givenName>Adam</< FONT>givenName>

<<sn>Harding</< FONT>sn>

<<title>T000169</< FONT>title>

<<mail>Adam.Harding@ltsbasset.co.uk</< FONT>mail>

<<department>Finance</< FONT>department>

</< FONT>User_Info>

This is a refresher of my C# code as well

Firstly I have "Service.cs"

Code Snippet

using System;

using System.Web;

using System.Web.Services;

using System.Web.Services.Protocols;

using System.Web.UI;

using System.Xml;

[WebService(Namespace = "http://afdintranet/ADLookup")]

[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]

public class Service

{

[WebMethod()]

public object ADQuery(string SearchParameter, string SearchString, string Attribute)

{

AD_Lookup objADL = (new AD_Lookup());

objADL.EnumerateSearch(SearchParameter, SearchString);

return objADL.GetAttribute(Attribute);

}

[WebMethod()]

public DataSet ADUserInfo()

{

AD_Lookup objADL = new AD_Lookup();

string usrCurrent = objADL.Get_sAMAccountName(HttpContext.Current.Request.ServerVariables["AUTH_USER"]);

// Get information about the user.

objADL.EnumerateSearch("sAMAccountName", usrCurrent);

// Search AD using the Account name of the current user.

string strGivenName = Convert.ToString(objADL.GetAttribute("givenName"));

string strSN = Convert.ToString(objADL.GetAttribute("sn"));

string strTitle = Convert.ToString(objADL.GetAttribute("title"));

string strMail = Convert.ToString(objADL.GetAttribute("mail"));

string strDepartment = Convert.ToString(objADL.GetAttribute("department"));

string strDistinguishedName = Convert.ToString(objADL.GetAttribute("distinguishedName"));

DataSet dsUser = new DataSet("AD_Info");

DataTable dtUserInfo = new DataTable("User_Info");

DataRow drAttrib = dtUserInfo.NewRow();

dtUserInfo.Columns.Add("givenName");

dtUserInfo.Columns.Add("sn");

dtUserInfo.Columns.Add("title");

dtUserInfo.Columns.Add("mail");

dtUserInfo.Columns.Add("manager");

dtUserInfo.Columns.Add("department");

dtUserInfo.Columns.Add("description");

dtUserInfo.Columns.Add("distinguishedName");

drAttrib["givenName"] = strGivenName;

drAttrib["sn"] = strSN;

drAttrib["title"] = strTitle;

drAttrib["mail"] = strMail;

drAttrib["department"] = strDepartment;

drAttrib["distinguishedName"] = strDistinguishedName;

dtUserInfo.Rows.Add(drAttrib);

dsUser.Tables.Add(dtUserInfo);

return dsUser;

}

}

Then I have the associated methods on "AD_Lookup.cs"

Code Snippet

using Microsoft.CSharp;

using System.DirectoryServices;

using System.DirectoryServices.Protocols;

using System.Data;

public class AD_Lookup

{

private SearchResult m_SearchResult;

public object GetAttribute(string Attribute)

{

return m_SearchResult.GetDirectoryEntry().Properties;

}

public void EnumerateSearch(string SearchParameter, string SearchString)

{

DirectorySearcher objDS = new DirectorySearcher("(" + SearchParameter + "=" + SearchString + ")");

m_SearchResult = objDS.FindOne();

}

public string Get_sAMAccountName(string strLogonName)

{

return strLogonName.Substring(strLogonName.IndexOf("\\") + 1);

}

}

I just don't know why, now the web services are behaving the same, (VB.NET and C#.NET) what is causing the C#.NET web service to not return the same data as the VB.NET web service.

If any one can help me complete this last niggle I will be very grateful.

Many thanks in Advance

Adam





Re: ASMX Web Services and XML Serialization Newbie C# programmer needing help

Adam Harding

OK

Done some searching on Web for Sytem.DirectoryServices.PropertyCollection and it seems that this pulls back the properties of the AD Userbut I am unsure as to integraing this code with my code above.

Anyone got any ideas

Thanks





Re: ASMX Web Services and XML Serialization Newbie C# programmer needing help

Andrei Teodorescu

hi there,

instead:

Code Block

public object GetAttribute(string Attribute)

{

return m_SearchResult.GetDirectoryEntry().Properties;

}

put this one:

Code Block

public object GetAttribute(string Attribute)

{

return m_SearchResult.GetDirectoryEntry().Properties[Attribute].Value;

}

you pass Attribute string and the function isn't use it at all Smile

and of course the Value of the Property ...