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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. Web Development
  3. ASP.NET
  4. how to solve this error ------>Access to the path 'C:\websites\afxisi.org\Export\contacts.csv' is denied ?

how to solve this error ------>Access to the path 'C:\websites\afxisi.org\Export\contacts.csv' is denied ?

Scheduled Pinned Locked Moved ASP.NET
databasesysadminhelptutorialquestion
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.
  • S Offline
    S Offline
    sugunavathysubramanian
    wrote on last edited by
    #1

    hai, i am doing crm project.i upload the database, file and data in new server path.but old server working fine.it export csv file .but new server display error.what can i do ?if you know answer replay to me.... Thank you...!

    N R 2 Replies Last reply
    0
    • S sugunavathysubramanian

      hai, i am doing crm project.i upload the database, file and data in new server path.but old server working fine.it export csv file .but new server display error.what can i do ?if you know answer replay to me.... Thank you...!

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

      Right click on the folder and provide access to ASP.NET user account.

      Navaneeth How to use google | Ask smart questions

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

        Right click on the folder and provide access to ASP.NET user account.

        Navaneeth How to use google | Ask smart questions

        S Offline
        S Offline
        sugunavathysubramanian
        wrote on last edited by
        #3

        hai, Thank You.i assign provision on this folder.but still doesn't work .anymore solution you known ?

        C 1 Reply Last reply
        0
        • S sugunavathysubramanian

          hai, Thank You.i assign provision on this folder.but still doesn't work .anymore solution you known ?

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

          Is this URL within your website ? What code is trying to open the file ?

          Christian Graus Driven to the arms of OSX by Vista.

          S 1 Reply Last reply
          0
          • C Christian Graus

            Is this URL within your website ? What code is trying to open the file ?

            Christian Graus Driven to the arms of OSX by Vista.

            S Offline
            S Offline
            sugunavathysubramanian
            wrote on last edited by
            #5

            hai, Thank You.this folder inside server.this code is work fine in afxisi.net server.but today i did upload my files,db.data change in afxisi.org server so this server not support. export csv coding ********** System.Threading.Thread.Sleep(3000); StreamWriter sw = new StreamWriter(Server.MapPath("Export\\contacts.csv")); sw.WriteLine("{0},{1},{2}","Title", "First Name", "Last Name"); if (con.State.ToString() == "Closed") { con.Open(); } SqlDataAdapter adp = new SqlDataAdapter("select title,firstname,lastname,officephone,mobileno,accountname,homephone,otherphone,fax,title1,department,donotcall,team,assignedto,emailprimary,secondaryemail1,secondaryemail2,secondaryemail3,primaryaddress,primarycity,primarystate,primaycountry,primaypostalcode,secondaryaddress,secondarycity,secondarystate,secondarycountry,secondarypostalcode,description,middlename,suffix,company,jobtitle,businessstreet2,businessstreet3,homestreet2,homestreet3,otherstreet,otherstreet2,otherstreet3,othercity,otherstate,otherpostalcode,othercountry,assistantsphone,businessfax,businessphone,businessphone2,callback,carphone,homefax,homephone2,isdn,pager,primaryphone,radiophone,ttytddphone,telex,aniversary,billinginformation,birthday,businessaddresspobox,categories,children,directoryserver,emailtype,emaildisplayname,email2type,email2displayname,email3type,email3displayname,gender,governmentidnumber,hobby,homeaddresspobox,initials,internetfreebusy,keywords,language,location,managersname,mileage,notes,officelacation,organizationalidnumber,otheraddresspobox,priority,private,profession,sensitivity,spouse,user1,user2,user3,user4,webpage,groupname,status from leads where groupname='" + txtgroupname.SelectedValue+"'", con); DataSet ds = new DataSet(); adp.Fill(ds); if (ds.Tables[0].Rows.Count > 0) { for (int io = 0; io < ds.Tables[0].Rows.Count; io++) { sw.WriteLine("{0},{1},{2}",ds.Tables[0].Rows[io][0].ToString(),ds.Tables[0].Rows[io][1].ToString(),ds.Tables[0].Rows[io][2].ToString()); } } if (con.State == ConnectionState.Open) {con.Close(); } sw.Close(); string filename = Server.MapPath("Export\\contacts.csv"); Session["filenames"] = filename; exportframe.Attributes["src"] = "./crmexport.aspx"; if you know any solution replay to me...

            C 1 Reply Last reply
            0
            • S sugunavathysubramanian

              hai, Thank You.this folder inside server.this code is work fine in afxisi.net server.but today i did upload my files,db.data change in afxisi.org server so this server not support. export csv coding ********** System.Threading.Thread.Sleep(3000); StreamWriter sw = new StreamWriter(Server.MapPath("Export\\contacts.csv")); sw.WriteLine("{0},{1},{2}","Title", "First Name", "Last Name"); if (con.State.ToString() == "Closed") { con.Open(); } SqlDataAdapter adp = new SqlDataAdapter("select title,firstname,lastname,officephone,mobileno,accountname,homephone,otherphone,fax,title1,department,donotcall,team,assignedto,emailprimary,secondaryemail1,secondaryemail2,secondaryemail3,primaryaddress,primarycity,primarystate,primaycountry,primaypostalcode,secondaryaddress,secondarycity,secondarystate,secondarycountry,secondarypostalcode,description,middlename,suffix,company,jobtitle,businessstreet2,businessstreet3,homestreet2,homestreet3,otherstreet,otherstreet2,otherstreet3,othercity,otherstate,otherpostalcode,othercountry,assistantsphone,businessfax,businessphone,businessphone2,callback,carphone,homefax,homephone2,isdn,pager,primaryphone,radiophone,ttytddphone,telex,aniversary,billinginformation,birthday,businessaddresspobox,categories,children,directoryserver,emailtype,emaildisplayname,email2type,email2displayname,email3type,email3displayname,gender,governmentidnumber,hobby,homeaddresspobox,initials,internetfreebusy,keywords,language,location,managersname,mileage,notes,officelacation,organizationalidnumber,otheraddresspobox,priority,private,profession,sensitivity,spouse,user1,user2,user3,user4,webpage,groupname,status from leads where groupname='" + txtgroupname.SelectedValue+"'", con); DataSet ds = new DataSet(); adp.Fill(ds); if (ds.Tables[0].Rows.Count > 0) { for (int io = 0; io < ds.Tables[0].Rows.Count; io++) { sw.WriteLine("{0},{1},{2}",ds.Tables[0].Rows[io][0].ToString(),ds.Tables[0].Rows[io][1].ToString(),ds.Tables[0].Rows[io][2].ToString()); } } if (con.State == ConnectionState.Open) {con.Close(); } sw.Close(); string filename = Server.MapPath("Export\\contacts.csv"); Session["filenames"] = filename; exportframe.Attributes["src"] = "./crmexport.aspx"; if you know any solution replay to me...

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

              OK, you're sure you're able to set the file permissions on the server ?

              Christian Graus Driven to the arms of OSX by Vista.

              S 1 Reply Last reply
              0
              • C Christian Graus

                OK, you're sure you're able to set the file permissions on the server ?

                Christian Graus Driven to the arms of OSX by Vista.

                S Offline
                S Offline
                sugunavathysubramanian
                wrote on last edited by
                #7

                yes i did set the permission .any other way you know ?

                1 Reply Last reply
                0
                • S sugunavathysubramanian

                  hai, i am doing crm project.i upload the database, file and data in new server path.but old server working fine.it export csv file .but new server display error.what can i do ?if you know answer replay to me.... Thank you...!

                  R Offline
                  R Offline
                  Ranjit Viswakumar
                  wrote on last edited by
                  #8

                  Chances are the user under which your code is running doesn't have permissions to the CSV. .NET may run under different users. I'd recommend adding read/modify on that file to the 'NETWORK SERVICE' and 'IUSR' permissions and try it again. Good luck. Ranjit Viswakumar Professional Services Specialist HostMySite.com[^]

                  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