.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Imran Ghani
Sohaib Khalid
Post New Web Links

What is DirectoryServices Equivalent of ADSystemInfo

Posted By:      Posted Date: October 01, 2010    Points: 0   Category :.NET Framework

Hi All,

In jscript I can do something like below and get at the properties and their values associated with that user.

Set objSysInfo = CreateObject("ADSystemInfo")
strUserName = objSysInfor.UserName
Set objUser = Getobject ("LDAP://" & strUserName)

To do this in C#...what I've got working is fine...but I couldn't find something equivalent to the "CreateObject...." other than to reference the ActiveDs typlib to retrieve the AD username..which seems like a bit of hack...is there a way to do this without the ActiveDs typelib?



ADSystemInfoClass adObject =

View Complete Post

More Related Resource Links

System.DirectoryServices NOT available


I have simply copied a page from a VS2005 project to a VS2010 project, and it will not work.

NO code-behind, just a simple Page_Load function in the .aspx page.

and okay, since this editor complete f's up a cut and paste from VS, I will type it all out....wonderful!


<script runat="server">

protected void Page_Load(object sender, EvnetArgs e)


   System.DirectoryServices.DirectoryEntry ...



This is really all you need to see.

The System.DirectoryServices is not available in intellisense and gives an error if I try to run this.

I have added the reference to my VS project - no go.

I have added a reference as an @Import at the top of the page - no go.

All other System classes appear to be available, but not DirectoryServices, so anyone know the secret handshake to get this to work in VS 2010?

What is the ASP.NET equivalent of history.back()


I'm converting a static site to ASP.NET. Each page has PREVIOUS and NEXT links. If a page has a specified PREVIOUS link in the database, I want to use that, otherwise send the user back to the last page visited (which used to be <a href="#" onclick="history.back(); return false;">)

What would be the correct syntax for: (insert code won't work, maybe because I'm using Opera?)

<a href="<%# IIf(Nz(Eval("intWebPageID_Previous"),0)>0, string.concat("Dynamic.aspx?w=", Eval("intWebSiteID"),"&p=", Eval("intWebPageID_Previous")), **LAST PAGE VISITED** %>"><span>Previous</span></a>


php stdclass equivalent?


Is there a stdclass equivalent in asp.net? I currently consumed a third party web service and they of course need a stdclass type array past to the function, but everything errors out. Hashtables, Idictionary, a standard object array, etc.... Is this possible to accomplish? Is it a huge workaround?

Getting Data equivalent to GroupBy using MDX

Select { [Measures].[Percentile_0], [Measures].[Percentile_100], [Measures].[Percentile_50], [Measures].[Percentile_5], [Measures].[Percentile_95], [Measures].[SampleSize]} ON 0 from [My Cube] WHERE  (  {[DimPremise].[Post Code Area].[All]} ,[DimPremise].[Age Band].[All] ,[DimPremise].[No Bed Rooms].[All] ,[DimPremise].[No Occupants].[All] ,[DimPremise].[Premise Type].[All] ,[DimContract].[Division].&[1] ) Above is the basic query which gives the percentile  of the whole dataset, but what i want here is that we get the selected maesures for all the combinations of the dimensions. For exmaple ...if i pass the dimension values then i will get the value, as show in below query. Select { [Measures].[Percentile_0], [Measures].[Percentile_100], [Measures].[Percentile_50], [Measures].[Percentile_5], [Measures].[Percentile_95], [Measures].[SampleSize]} ON 0 //, //( // [DimPremise].[Age Band].&[A1]  //,[DimPremise].[No Bed Rooms].&[1] //,[DimPremise].[No Occupants].&[1] //,[DimPremise].[Premise Type].&[0001]) //on 1 from [Consumption Hub] WHERE  (  //{[DimPremise].[Post Code Area].[All]} --, [DimPremise].[Age Band].&[A1] ,[DimPremise].[No Bed Rooms].&[1] ,[DimPremise].[No Occupants].&[1] ,[DimPremise].[Premise Type].&[0001] , [DimContract].[Division].&[1] ) So just to make things work i tried using the crossjoi

equivalent of EnableVisualResizing?

I want to enable my ActivityDesigner objects to be resized by dragging one corner of the designer after it is involved in the editor. The older ActivityDesigner class had the EnableVisualResizing property. Where is that in the new presentation-based ActivityDesigner?

syscolumns language equivalent in sys.columns sql 2008

Hi - I was looking for the equivalent field of language in syscolumns, in SQL 2008 sys.columns catalog view. Can some one help? thanks in advance!

LicenseProvider equivalent for an entire assembly

sorry for cross-posting... maybe this forum is better for licensing issues... --       Hi Everybody!   I need some licensing mechanism for several class library assemblies we developed.   I found much documentation about the .NET Framework LicenseProvider class, which is very useful if you want to protect controls and components.   Is there any equivalent to protect an entire assembly? Or should I add a LicenseProviderAttribute to any class in my library? ... this would be a very hard work to do...     Your help appreciated! Thank you in advance! =WereWolf=

System.DirectoryServices.AccountManagement: FileNotFound exception while creating PrincipalContext o

Hi, I want to create a local group for my Netapp server. And also add a domain user under this group. Using .NET namepaces System.DirectoryServices.AccountManagement, I can achive this for Windows server. But if the same code is tried on NetApp, following exception is thrown: Unhandled Exception: System.IO.FileNotFoundException: The system cannot find the file specified. (Exception from HRESULT: 0x80070002)   at System.DirectoryServices.Interop.UnsafeNativeMethods.IAds.GetInfo()   at System.DirectoryServices.DirectoryEntry.RefreshCache()   at System.DirectoryServices.AccountManagement.PrincipalContext.DoMachineInit()   at System.DirectoryServices.AccountManagement.PrincipalContext.Initialize()   at System.DirectoryServices.AccountManagement.PrincipalContext.get_QueryCtx()    at System.DirectoryServices.AccountManagement.Principal.FindByIdentityWithTypeHelper(PrincipalContext context, Type principalType, Nullable`1 identityType, String identityValue, DateTime refDate)   at System.DirectoryServices.AccountManagement.Principal.FindByIdentityWithType(PrincipalContext context, Type principalType, String identityValue)   at System.DirectoryServices.AccountManagement.GroupPrincipal.FindByIdentity(PrincipalContext context, String identityValue)   at AddGroup.Program.Main(String[] args) Does S

before insert equivalent in sql server

Is there an equivalent of "Before insert" trigger of Oracle in SQL Server 2005. I tried "Instead of" trigger but It does not actually insert into the main table and executes the statements defined in the trigger. Currently I hav two after insert triggers in sql server both of which are getting called upon insert. I want to differentiate them as I am doing it in ORACLE by defining one of the two as BEFORE INSERT trigger.

Need vb.net equivalent of this line of c# code....

I have a line of c# that I'm looking to convert into vb.  It looks like the following:return GetFromSession("CurrentUser") as Account; "GetFromSession" is a method which returns an object. Here's the code for that method if it helps:private static object GetFromSession(string key) { if (HttpContext.Current == null || HttpContext.Current.Session == null) { return null; } return HttpContext.Current.Session[key]; } My problem is the "as Account" part of my one line of c# code needs to be converted into vb but I'm not sure of the equivalent. Currently, my vb.net won't allow it. Any idea what I should use here? Thanks  

Folders or folder like equivalent in SQL Server 2008 ? for packages & stored procedures ?

Hi,      Currently running SQL-Server 2000.  We have hundreds of stored procedures and DTS packages. We have so many it's becoming a serious challenge for names and such.  We were wondering if SQL Server 2008 has a way to 'nest' both the equivalent of DTS packages (SSIS) and stored procedures in something akin to 'folders'.  We know we have to upgrade one of these days but a version that would handle these would be much more attractive. Just getting this functionality would be worth whatever effort would be required to upgrade.   Thanks in advance for any help on this.

SPS 2003 equivalent of SPExport / SPImport

Is there anything in the SPS 2003 object model that is the equivalent of SPExport / SPImport objects in the 2007 object model?   Ultimately I'm trying to export a sub site from 2003. I can export a top level site but the processing time for my current site collection is 18 hours and I want to make it a little more granular. Any suggestions are appreciated.

Creating assembly throwing an error as system.directoryservices assembly is not in the SQL Server

Hi, I am trying to create an assembly (DLL file that created by C# ) which uses System.DirectoryServices assembly. When I try with following script Create ASSEMBLY Addresstype From 'C:\ActiDirectoryFunctions\ActiveDirectoryFunctions.dll' I am getting following Error Assembly 'ActiveDirectoryFunctions' references assembly 'system.directoryservices, version=, culture=neutral, publickeytoken=b03f5f7f11d50a3a.', which is not present in the current database. SQL Server attempted to locate and automatically load the referenced assembly from the same location where referring assembly came from, but that operation has failed (reason: 2(The system cannot find the file specified.)). Please load the referenced assembly into the current database and retry your request. From above error message, I learnt that System.DirectoryServices assembly is not in the SQL Server. I am using SQL SERVER 2005 SP2 and .Net Framework 3 is there in the machine How to manually add this assembly into this SQL Server Machine? Please let me know if you know Thank you, Raj Dreaming a world without any war in anywhere

T-SQL Equivalent For Group_Concat() Function

Hello, I am looking for a way to do the MSSQL T-SQL equivalent of the MySQL aggregate function: group_concat(). We are running SQL 2005 Express. Is there a pure T-SQL way to do this, or if not, a way to create a new custom aggregate function? EX: SELECT GROUP_CONCAT(FIRST_NAME) AS STUDENT_LIST FROM STUDENTS GROUP BY TEACHER OUTPUT: JOSH,JOEY,MARK,LINDA,PAM,BILL,MIKE,JUSTIN

What is the Equivalent of CollectionViewSource for only one Object?

I baiscally want to have access to the same things that a CollectionViewSource provides except that I am only dealing with one object. For example in CollectionViewSource I could do this: Source="{Binding Source={x:Static Application.Current}, Path=myObjects}" But there doesn't seem to be anythign else that has the "Source" option that only deals with a single object 

JNDI equivalent in .Net

Hi , Is there any equivalent function in .net similar to JNDI in dotnet. I want to preprocess a value set in Environment variable in web.config file. Thanks in Advance

Cron Jobs equivalent

Is there something like that in Asp.Net as We have Cron Jobs in php?Actually i want to run a particular page on the Server at the given time.I am using Ms- Access db.How can i do that coz hosting provider deny to schedule this webpage on that server using Control Panel.Thanks in Advance.
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend