Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. help me!!! Could not find a part of the path "D:\".

help me!!! Could not find a part of the path "D:\".

Scheduled Pinned Locked Moved ASP.NET
helpcsharpsysadminquestion
8 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • N Offline
    N Offline
    Nafiseh Salmani
    wrote on last edited by
    #1

    i use following code to create a folder (.net 1.1)

    if ( Directory.Exists(Server.MapPath("~/temp") +"/"+ SID) )//Request.PhysicalApplicationPath +
    //"temp\\" + SID) )
    {
    lbl_event.Text=ss;
    Directory.Delete( Server.MapPath("~/temp") +"/"+ SID, true );
    }
    Directory.CreateDirectory(Server.MapPath("~/temp") +"/"+ SID );

    and following error appear "Could not find a part of the path "D:\"." you can see the error with its details http://kmrt.ir/Welcome.aspx[^] it is not for permission! anyone know how could i solve it?!! please help me

    G C N 3 Replies Last reply
    0
    • N Nafiseh Salmani

      i use following code to create a folder (.net 1.1)

      if ( Directory.Exists(Server.MapPath("~/temp") +"/"+ SID) )//Request.PhysicalApplicationPath +
      //"temp\\" + SID) )
      {
      lbl_event.Text=ss;
      Directory.Delete( Server.MapPath("~/temp") +"/"+ SID, true );
      }
      Directory.CreateDirectory(Server.MapPath("~/temp") +"/"+ SID );

      and following error appear "Could not find a part of the path "D:\"." you can see the error with its details http://kmrt.ir/Welcome.aspx[^] it is not for permission! anyone know how could i solve it?!! please help me

      G Offline
      G Offline
      Guffa
      wrote on last edited by
      #2

      Nafiseh Salmani wrote:

      Server.MapPath("~/temp") +"/"+ SID

      What kind of system are you using? That would work on a *nix system, as that uses "/" as file path separator, but it would not work on a Windows system, as that uses "\" as file path separator. You should use the Path.Combine method to form the path, that way it will work regardlesss of what file path separator the system uses: Path.Combine(Server.MapPath("~/temp"), SID)

      Despite everything, the person most likely to be fooling you next is yourself.

      N 1 Reply Last reply
      0
      • G Guffa

        Nafiseh Salmani wrote:

        Server.MapPath("~/temp") +"/"+ SID

        What kind of system are you using? That would work on a *nix system, as that uses "/" as file path separator, but it would not work on a Windows system, as that uses "\" as file path separator. You should use the Path.Combine method to form the path, that way it will work regardlesss of what file path separator the system uses: Path.Combine(Server.MapPath("~/temp"), SID)

        Despite everything, the person most likely to be fooling you next is yourself.

        N Offline
        N Offline
        Nafiseh Salmani
        wrote on last edited by
        #3

        i checked

        Server.MapPath("~/temp") +"/"+ SID

        . it works . just when i use

        Directory.Delete

        or

        Directory.CreateDirectory

        it takes Error. i set the permission also! How could I solve it?

        G 1 Reply Last reply
        0
        • N Nafiseh Salmani

          i use following code to create a folder (.net 1.1)

          if ( Directory.Exists(Server.MapPath("~/temp") +"/"+ SID) )//Request.PhysicalApplicationPath +
          //"temp\\" + SID) )
          {
          lbl_event.Text=ss;
          Directory.Delete( Server.MapPath("~/temp") +"/"+ SID, true );
          }
          Directory.CreateDirectory(Server.MapPath("~/temp") +"/"+ SID );

          and following error appear "Could not find a part of the path "D:\"." you can see the error with its details http://kmrt.ir/Welcome.aspx[^] it is not for permission! anyone know how could i solve it?!! please help me

          C Offline
          C Offline
          Christian Graus
          wrote on last edited by
          #4

          Did you consider using the debugger to see what the path is it's trying to write to ?

          Christian Graus No longer a Microsoft MVP, but still happy to answer your questions.

          N 1 Reply Last reply
          0
          • C Christian Graus

            Did you consider using the debugger to see what the path is it's trying to write to ?

            Christian Graus No longer a Microsoft MVP, but still happy to answer your questions.

            N Offline
            N Offline
            Nafiseh Salmani
            wrote on last edited by
            #5

            I cant use it! because it happen when i upload it not at localhost :doh:

            C 1 Reply Last reply
            0
            • N Nafiseh Salmani

              I cant use it! because it happen when i upload it not at localhost :doh:

              C Offline
              C Offline
              Christian Graus
              wrote on last edited by
              #6

              Then write a page which works out the path and writes it to the page, so you can see what you're dealing with.

              Christian Graus No longer a Microsoft MVP, but still happy to answer your questions.

              1 Reply Last reply
              0
              • N Nafiseh Salmani

                i checked

                Server.MapPath("~/temp") +"/"+ SID

                . it works . just when i use

                Directory.Delete

                or

                Directory.CreateDirectory

                it takes Error. i set the permission also! How could I solve it?

                G Offline
                G Offline
                Guffa
                wrote on last edited by
                #7

                Nafiseh Salmani wrote:

                i checked Server.MapPath("~/temp") +"/"+ SID . it works .

                In what sense do you mean that it works? If you are using it as a path in a Windows system, it's not correct. It might work eventhough in some situations, but fail in others.

                Nafiseh Salmani wrote:

                How could I solve it?

                Eh? I already told you. Gave you the code for it and everything.

                Despite everything, the person most likely to be fooling you next is yourself.

                1 Reply Last reply
                0
                • N Nafiseh Salmani

                  i use following code to create a folder (.net 1.1)

                  if ( Directory.Exists(Server.MapPath("~/temp") +"/"+ SID) )//Request.PhysicalApplicationPath +
                  //"temp\\" + SID) )
                  {
                  lbl_event.Text=ss;
                  Directory.Delete( Server.MapPath("~/temp") +"/"+ SID, true );
                  }
                  Directory.CreateDirectory(Server.MapPath("~/temp") +"/"+ SID );

                  and following error appear "Could not find a part of the path "D:\"." you can see the error with its details http://kmrt.ir/Welcome.aspx[^] it is not for permission! anyone know how could i solve it?!! please help me

                  N Offline
                  N Offline
                  nyeboy
                  wrote on last edited by
                  #8

                  You had better debug it,or create a new file to debug filepath validation.Certainly,you also use following: Directory.Delete(Server.MapPath(@"./temp")+"//"+sid,true); or Directory.Delete(Server.MapPath(".//temp")+"//"+sid,true); Ple notice "/" in limit!

                  studing is processing in this life.

                  1 Reply Last reply
                  0
                  Reply
                  • Reply as topic
                  Log in to reply
                  • Oldest to Newest
                  • Newest to Oldest
                  • Most Votes


                  • Login

                  • Don't have an account? Register

                  • Login or register to search.
                  • First post
                    Last post
                  0
                  • Categories
                  • Recent
                  • Tags
                  • Popular
                  • World
                  • Users
                  • Groups