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. Permission error when creating folder through vb.net code

Permission error when creating folder through vb.net code

Scheduled Pinned Locked Moved ASP.NET
csharpasp-netsecurityhelp
5 Posts 2 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.
  • H Offline
    H Offline
    hozsam
    wrote on last edited by
    #1

    Hi, I am trying to create folders dynamically using asp.net 2005. The code that i use here is already being used in .Net 2003 and is working fine there. But when i do the same thing in .Net 2005 the following is the error that i m getting : Request for the permission of type 'System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed. I have given write permissions to everyone for that folder still it does not work. And this is not working on my local machine itself. If anyone can suggest some solution to this. thanks, sabiha.

    N 1 Reply Last reply
    0
    • H hozsam

      Hi, I am trying to create folders dynamically using asp.net 2005. The code that i use here is already being used in .Net 2003 and is working fine there. But when i do the same thing in .Net 2005 the following is the error that i m getting : Request for the permission of type 'System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed. I have given write permissions to everyone for that folder still it does not work. And this is not working on my local machine itself. If anyone can suggest some solution to this. thanks, sabiha.

      N Offline
      N Offline
      N a v a n e e t h
      wrote on last edited by
      #2

      It's very tough to answer as you haven't provided any code that you use.

      Navaneeth How to use google | Ask smart questions

      H 1 Reply Last reply
      0
      • N N a v a n e e t h

        It's very tough to answer as you haven't provided any code that you use.

        Navaneeth How to use google | Ask smart questions

        H Offline
        H Offline
        hozsam
        wrote on last edited by
        #3

        Here is the code that i use to create folders : MImageDirectoryName = "~/pictures/folder1" MImageDirectoryPath = Server.MapPath(MImageDirectoryName) If Dir(MImageDirectoryPath, FileAttribute.Directory) = "" Then MkDir(MImageDirectoryPath) End If The folder1 used here has read/write permissions. I feel as if the problem lies in the line server.mappath, also tried writing ../pictures/folder1, pictures/folder1 but still no use gives the same error.

        N 1 Reply Last reply
        0
        • H hozsam

          Here is the code that i use to create folders : MImageDirectoryName = "~/pictures/folder1" MImageDirectoryPath = Server.MapPath(MImageDirectoryName) If Dir(MImageDirectoryPath, FileAttribute.Directory) = "" Then MkDir(MImageDirectoryPath) End If The folder1 used here has read/write permissions. I feel as if the problem lies in the line server.mappath, also tried writing ../pictures/folder1, pictures/folder1 but still no use gives the same error.

          N Offline
          N Offline
          N a v a n e e t h
          wrote on last edited by
          #4

          Have you tried to use Directory class? Directory.CreateDirectory should do the trick.

          Navaneeth How to use google | Ask smart questions

          H 1 Reply Last reply
          0
          • N N a v a n e e t h

            Have you tried to use Directory class? Directory.CreateDirectory should do the trick.

            Navaneeth How to use google | Ask smart questions

            H Offline
            H Offline
            hozsam
            wrote on last edited by
            #5

            Thank you for your reply. Yes i tried using the directory class as you suggested but still the same permission issue. Actually the problem does not lie in the method we create folders but the statement that i write for getting path which is as under :- MImageDirectoryName = "../Pictures/folder1" MImageDirectoryPath = Server.MapPath(MImageDirectoryName) It gives error in the line server.mappath ..... Can you suggest anything else pls ..... thanks, sabiha.

            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