Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6740639
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T11:37:48+00:00 2026-05-26T11:37:48+00:00

In this question I’m using Visual Studio 2008. My code is quite simple, as

  • 0

In this question I’m using Visual Studio 2008. My code is quite simple, as it was used from a reference I grabbed off the web. I’m using ASP/VB.Net, IIS6.0 on a Windows Server 2003 box.

I’ve looked at various sources online, and have not been able to piece together a proper result.

The purpose of this is to list a slew of directories and their respective files, and allow the user to eventually manage that directory (such as open and delete files).

Here is my ASPX page:

<%@ Page Language="vb" AutoEventWireup="false" CodeBehind="DirectoryList.aspx.vb" Inherits="VCMReports.DirectoryList" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>Untitled Page</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
    <asp:DataGrid runat="server" id="articleList" Font-Name="Verdana"
    AutoGenerateColumns="False" AlternatingItemStyle-BackColor="#eeeeee"
    HeaderStyle-BackColor="Navy" HeaderStyle-ForeColor="White"
    HeaderStyle-Font-Size="15pt" HeaderStyle-Font-Bold="True">
  <Columns>
    <asp:HyperLinkColumn DataNavigateUrlField="Name" DataTextField="Name" 
           HeaderText="File Name" />
    <asp:BoundColumn DataField="LastWriteTime" HeaderText="Last Write Time"
        ItemStyle-HorizontalAlign="Center" DataFormatString="{0:d}" />
    <asp:BoundColumn DataField="Length" HeaderText="File Size"
        ItemStyle-HorizontalAlign="Right" 
        DataFormatString="{0:#,### bytes}" />
  </Columns>
</asp:DataGrid>  

    </div>
    </form>
</body>
</html>

And here is the CodeBehind:

Imports System.IO
Imports System.IO.DirectoryInfo

Partial Public Class DirectoryList
    Inherits System.Web.UI.Page

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        Dim dirInfo As New DirectoryInfo(Server.MapPath("V:\Users\"))

        articleList.DataSource = dirInfo.GetFiles("V:\Users\")
        articleList.DataBind()

    End Sub
    Protected Sub GetFiles()

        Dim files() As String = Directory.GetFiles("V:\Users\")

        Dim myDir As DirectoryInfo = New DirectoryInfo("V:\Users\")
        Dim fileInfos() As IO.FileInfo = myDir.GetFiles("*.*")
    End Sub

When launching the page, the following error appears:

'V:\Users\' is not a valid virtual path. 
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

Exception Details: System.Web.HttpException: 'V:\Users\' is not a valid virtual path.

Things I have tried:

  1. On the server, I have mapped out the drive and the directory.
  2. Permissions seem to be properly set, impersonate is correct.
  3. If I were to list a directory in the actual directory “C:\Inetpub\Directory\”, there is no failure.
  4. I do understand this is incomplete for the Directory listing portion, this will only list files (so this will need to be modified.
  5. I have attempted to create a Virtual Directory, and the application presented the same error.
  6. On my local development machine, I have the same path created – same error.

How am I able to view the contents of a shared directory and it’s files?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T11:37:48+00:00Added an answer on May 26, 2026 at 11:37 am

    Here you find the answer on your first part of the question, why Server.MapPath cannot(and should not) be used to resolve the path to a network share: http://forums.asp.net/t/785846.aspx/1

    The second question mentioned in your comment is how to list all directories in a directory:

    myDir.GetDirectories()
    

    http://msdn.microsoft.com/en-us/library/s7xk2b58.aspx

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This question is about removing sequences from an array, not duplicates in the strict
This question is related to a similar case, namely Removing inline styles using php
This question comes from a range of other questions that all deal with essentially
This question is related to UITableView issue when using separate delegate/dataSource , though I
This question follows on from my other question on why my app isn't being
This question is a bit long due the source code, which I tried to
This question follows on from the answer given by Michael Pilat in Preventing Plus
This question is specific to the MSVC compiler (specifically 2008), but I'm interested in
This question is from a C# guy asking the C++ people. (I know a
( This question about refactoring F# code got me one down vote, but also

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.