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

  • SEARCH
  • Home
  • 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 8926823
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T08:04:35+00:00 2026-06-15T08:04:35+00:00

In command line it works fine: net USE T: \123.45.67.89\TEST mytestuser /user:MYTESTUSER But using

  • 0

In command line it works fine:
net USE T: \123.45.67.89\TEST mytestuser /user:MYTESTUSER

But using asp.net, with the following code, the Exception with the following error is always thrown: ‘The local device name is already in use’ when mapping drive

I have tried disconnecting from all drives first, mapping to a different Drive letter. I have done this from different servers, and to different servers

Is the problem definitely with drive letter?

temp = MapDrive("T", "\\123.45.67.89\TEST", "MYTESTUSER", "mytestuser")


Public Shared Function MapDrive(ByVal DriveLetter As String, ByVal Path As String, ByVal Username As String, ByVal Password As String) As Boolean


    Dim ReturnValue As Boolean = False

    Dim p As New System.Diagnostics.Process()
    p.StartInfo.UseShellExecute = False
    p.StartInfo.CreateNoWindow = True
    p.StartInfo.RedirectStandardError = True
    p.StartInfo.RedirectStandardOutput = True
    p.StartInfo.FileName = "net.exe"
    p.StartInfo.Arguments = " use " & DriveLetter & ": " & Path & " /user:" & Username & " " & Password & " /persistent:yes"
    p.Start()
    p.WaitForExit()
    Dim ErrorMessage As String = p.StandardError.ReadToEnd()
    Dim OuputMessage As String = p.StandardOutput.ReadToEnd()
    Dim StoreFile As System.IO.Directory
    Dim Files As String()
    Dim File As String


If ErrorMessage.Length > 0 Then
        Throw New Exception("Error:" & ErrorMessage)

    Else
        ReturnValue = True
    End If

     Files = StoreFile.GetFiles("T:\FINDTHIS\", "*")


     For Each File In Files

        HttpContext.Current.Trace.Warn(File)
     Next


    Return ReturnValue
End Function
  • 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-06-15T08:04:36+00:00Added an answer on June 15, 2026 at 8:04 am

    Aren’t mapped drives particular to the user that is running the net command?

    Your asp.net page usually runs under a different identity to the current user’s. This means that your code might possibly map the network path successfully the first time you run it. Then when you run it the second time you will get that error.

    But then you are looking in vain to delete the mapping for that letter in your cmd window since the drive was not mapped via your user identity (under which your cmd window is running after all)

    Then there’s also the permissions needed to run the net command, although that might have thrown a different error.

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

Sidebar

Related Questions

I run javac from command line in windows(cmd.exe) - it works fine. But when
running asp.net mvc website that has code that connects to oracle. Works fine on
UPDATE queries work fine from the mysql command line, for any user. However, when
Can anyone convert this curl command that works in command line to php code
this is the curl code that works in command line : $ curl -F
I'm trying to deploy an ASP.NET MVC 2 app using MsDeploy. I use VS2010
I use Inno Setup for creating my setup. All works fine, but I run
I have a web site built using ASP.NET MVC4 that I can publish fine
I'm trying to open a mpg-File using emguCV. I use the following code: if
Had to download Command Line Tools from Apple to get make to work, but

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.