Results 1 to 4 of 4

Thread: How to create directory in ASP.net

  1. #1
    Join Date
    Jul 2009
    Posts
    36

    How to create directory in ASP.net

    Hello friends,

    I am facing some issue with my project when i am trying to create a directory by using Directory class, it's not allowing me to find do so and at the same time i am unable to find a shared function which allows me to create a directory, I have tried to lot over internet but was not able to get proper solution. Can anyone tell me how to create directory in ASP.net ?

  2. #2
    Join Date
    Nov 2005
    Posts
    403

    Create directory in ASP.net

    If you want to create a directory in ASP.net then simply write directory to the disk, before that you need to import System.IO namespace, this contains the CreateDirectory() method that we will be used to create your directory and if you are using Server Intellect then insert the following code in btnSubmit_Click() event.

    Code:
    Protected Sub btnSubmit_Click(ByVal sender1 As Object, ByVal e As System.EventArgs) Handles btnSubmit.Click
    Try
    Directory.CreateDirectory(MapPath(".") & "\" & txt_Dir.Text)
    Catch ex1 As Exception
    lblStatus.Text = ex1.Message
    End Try
    End Sub

  3. #3
    Join Date
    Apr 2009
    Posts
    47

    How to create directory in ASP.net

    I also want to create a folder in asp.net with by using Create Directory Function, i have tried a lot but i am not able to create one for me, does anyone provide me any code where i can create directory in ASP.net using Create Directory Function. Thanks in Advance.

  4. #4
    Join Date
    Jan 2009
    Posts
    150

    Re: How to create directory in ASP.net

    It's very simple if you want to use Create Directory Function in asp.net then try to use the below code which will create a directory for you. I am sure this will work for you and if a directory exist then you will get a message as Directory Already Exist.

    Code:
    Public Function CreateDirectory(ByVal Directory_Name As String) As String
            If Directory.Exists(Server.MapPath(Directory_Name)) Then
                Return "Directory Already Exist"
            Else
                Try
                    Directory.CreateDirectory(Server.MapPath(Directory_Name))
                    Dim oMenu As New cMenu
                Catch ex As Exception
                    Return "Failue" + ex.ToString
                End Try
            End If
            Return "Success"
        End Function

Similar Threads

  1. Create Active Directory integrated zone in DNS
    By Brruno in forum Networking & Security
    Replies: 3
    Last Post: 12-11-2010, 06:17 AM
  2. Should I create a virtual directory
    By Lashawn in forum Software Development
    Replies: 5
    Last Post: 19-01-2010, 09:28 PM
  3. How to create a directory in c++
    By Gomeler in forum Software Development
    Replies: 3
    Last Post: 25-11-2009, 11:14 AM
  4. useradd: cannot create directory
    By MobiNuX in forum Operating Systems
    Replies: 2
    Last Post: 30-07-2009, 10:51 PM
  5. How to create an alias for a directory in Unix
    By Bull50 in forum Operating Systems
    Replies: 3
    Last Post: 02-05-2009, 09:05 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,714,257,539.49985 seconds with 17 queries