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

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

List Directory Help

Posted By:      Posted Date: September 20, 2010    Points: 0   Category :ASP.Net


Using asp.net I'm trying to have a list directory for files located in a shared drive s:/

The webpage is stored on a local web server and i want it to show files/folders in the shared drive.

I'm able to do it if the files are located on the same server but I get a error message if i try to have a list directory in the shared drive.

's:/test' is not a valid virtual path. 

Everyone can access the shared drive so there are no permission issues.

%@ Page Language="VB" %>
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.IO" %>
<script language="VB" runat="server">

	Sub Page_Load(sender as Object, e as EventArgs)
		Dim strThisPage   As String = Request.ServerVariables("URL")
		dim strRootPath As String = "s:/test"
		Dim strPath       As String
		Dim strFullPath   As String

		Dim myRootDirInfo As DirectoryInfo
		Dim arrInfos    

View Complete Post

More Related Resource Links

Getting list of users reporting from specific Manager from Active Directory


Dear All,

I am have requirement like displaying all the user information reporting to specific manager from Active Directory.

Please help me regarding this.



List Users from Active Directory


When i try to List the users from Active directory, i get this exception.

Error while processing.System.Runtime.InteropServices.COMException (0x80072020): An operations error occurred at System.DirectoryServices.DirectoryEntry.Bind(Boolean throwIfFail) at System.DirectoryServices.DirectoryEntry.Bind() at System.DirectoryServices.DirectoryEntry.get_AdsObject() at System.DirectoryServices.DirectorySearcher.FindAll(Boolean findMoreThanOne) at System.DirectoryServices.DirectorySearcher.FindAll()

The code i used is :

DirectoryEntry de = new DirectoryEntry(_path);DirectorySearcher deSearch = new DirectorySearcher();

deSearch.SearchRoot =de;

deSearch.Filter = "(&(objectClass=user) (cn=" + UserName +"))";

SearchResultCollection results = deSearch.FindAll();

 But the DirectoyEntry method is getting validated if i use the overloaded method : DirectoryEntry(_path, domainAndUsername, password);

Please advice me.

Maintain users and groups list of Active Directory for an asp.net web application only

Hi, I have configured active directory in my server 2008. We have a web project using asp.net mvc named Audit planning and Execution Software(Apex2).What we want to do is to authenticate Active directory users for this project.I can get all active directory users, groups, users of a group etc.I want to add users in active directory for the Apex2 project only using asp.net.I also want to display only the users and groups of Active Directory registered with the Apex2 project only. And I also want to add active directory users from whole AD list to our project's AD list. Can you please tell me, how will I do this. Shall I create an Organizational Unit and maintain all users and groups there for our project? Or, is there any other way to do this?  please help me.Thank You

Editing List that is populated by Active Directory



I'm doing some work for a customer that has a Telephone Directory list on his Sharepoint intranet home page. The list is populated from the "Users & Groups" in sharepoint, but they can edit the entries to change things like extension numbers, etc within the list.

Recently, they have reported that they are unable to edit the entries. I have VPN'd onto their site and, indeed, they can't.

Having not designed their system myself, I can't confirm how the list was set up, so... here is my big ask:

1) How would this have most likley been set up?

2) What is the most likley cause for their newly-found restrictions?

They guy claims that he hasn't changed anything lately, but... well, we all know customers, right?

Sorry to be so vague about this. If I learn any more detail, I will post here.


How to add "List this new site in the site directory" category on Create Site page


I have a problem with the Site Directory in our SharePoint portal (MOSS 2007). The portal has been migrated from 2003 to 2007. If I create a new site create under the site directory then the site is not listed in the Site Directory.

The problem what I found is, when I create a site collection "List this new site in the site directory " check box is not available on Site creation page.

could some help me how can I make this(List this new site in the site directory) check box available on the create site page.




Senthilrajan Kaliyaperumal

Populate Drop-Down list box from Active Directory Data Connection?


I recently created a data connection to my active directory, so that certain fields can be automatically populated given the user who is filling in the form.

However, I would like to have a drop-down box that is populated from Active Directory (i.e. the user of the form can select another AD member), the result of which will then populate other fields (with information such as Manager, Email Address, etc).

So, 2 questions:

  1. How do I get a drop-down list to populate with the members of AD?
  2. How do I get the result of this selection to populate other fields?
Cheers again - you guys are great!

Active Directory - List group managed by a specific user


Hello every body,

I need to know how I can find which groups of an active directory are managed by a specific user. The idea is to create a WinForm appication where the user enter a name and then, the code chek whicjh group of the AD is managed by the name entered.

Has someone any idea? I jusrt need specification about the Active Directory classes and methods...

Thanks ;-)

Directory List In treeView


I am using Visual Studio 2008 Standard Edition, Visual C++, Windows Forms Application.

I am trying to display directories in a treeView box in much the same was as Windows Explorer displays directories. I can display each parent directory and I can click on a parent directory and display the child directory but the display shows the full path of each directory.

This is what my treeView shows if I click on C:\Directory_A then click Directory_B:





This is what I would like it to show

- Directory_A

            - Directory_B


 How do I display the directories and sub directories without the path (similar to Windows Explorer)?



Automatically validate names in SharePoint list to Active Directory names


I have some employee names in a list. Since there is employee turnover, I want to be able to keep a track of which employees have left so that I can take appropriate action. Currently it is a manual process to look at each member of the list and compare it against the GAL. Is there a OOTB feature / script / workflow I can use that does a check of the employee name against the name in Active Directory to ensure if the user still exists and if the user does not exist then it send an email to me automatically.

Ravi Acharya

Building a Searchable Phone Directory with Windows SharePoint Services

I want to continue to build out the intranet site we've started in our previous articles. A standard item in every intranet is a staff/employee list. Most companies implementing Windows SharePoint Services (WSS) are large enough to have a database that contains all employees. We will use the aggregation features of SharePoint to include data from this database into our intranet.

Ready made List Types provided by SharePoint

SharePoint provides some out of the box List Types. Some of the most used ready made list types that SharePoint provides currently are listed below:

Export SharePoint List to Excel Spreadsheet Programmatically using C#

In SharePoint applications, Custom Lists are used to store business data and Document Libraries to store the documents. But for data manupulation and analysis, Microsoft Excel provides very rich features as compared to SharePoint Lists. That's why people still loves to work on Microsoft Excel Sheets.

Dropdown list in ASP.NET - How to get value selected

am sure this must be very simple, but unforunately I can't figure it out.
I have the following code which populates the dropdown lists from the database. This works fine. Now, when the user selects a particular employee name from the list, I want to get the Employee Id of the selected employee. i.e. I need to get the "Eid" value. I can do this if the EId is loaded in the dropdown list, but in this case only the employee name is displayed. Please let me know howI can get the Eid value even though it is not loaded in the dropdown list.
I would really appreciate your help

Creating Sites/Lists/List Items under Current User Context in SharePoint By Using SPUserToken

Usually we do this by performing the action under RunWithElevatedPrivileges method and updating the listitem using SPListItem.SystemUpdate() method (see here). but this approach has its own flaws like (RunWithElevatedPrivileges will run under system account, we cannot use SystemUpdate for SPSite,SPWeb,SPList, since it runs under system we will "CreatedBy" by as SystemAccount).

Editable Gridview with Textbox, CheckBox, Radio Button and DropDown List

This is an example of an editable gridview containing different ASP.NET controls. When user wants to edit values in gridview, she/he can use these controls to edit existing values in Gridview Edit Mode.

Using the Code

Get pixel format, raw format, property id list and property items image in VB.net - C#.net.

n this simple article you will learn that how we can get pixel format, raw format, property id list and property items image in VB and C#.net.

Get Pixel Format:

Image consists of pixels to get the format of the pixel we have a property named pixel format. This property returns an enumeration of pixel format. This enumeration tells the pixel format.

To demonstrate make a window application. Drag one button and a picture box on form.

Now write the following code on Button click event:

Binding an array to dropdown list


I have the following string which is a list of urls. How do I get this to work so the url shows for the selection and also is the value?      


allLinks = newAllLinks
        Me.DropDownList1.DataTextField = "Link"
        Me.DropDownList1.DataValueField = "LinkURL"
        Me.DropDownList1.Items.Insert(0, New ListItem(" - Select - ", 0))
        Me.DropDownList1.DataSource = allLinks


 ArgumentNullException: Value cannot be null.
Parameter name: container]
   System.Web.UI.DataBinder.GetPropertyValue(Object container, String propName) +121
   System.Web.UI.DataBinder.GetPropertyValue(Object container, String propName, String format) +8

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