Accessing the current directory?

Discussion in 'ASP.NET 2.0' started by DenverMike, Nov 28, 2006.

  1. I'm trying to access the current directory (the one in which my application is installed).

    I thought it'd be as easy as:
     
  2. To create/write to a file within App_Data folder do somethiing like :



    System.IO.StreamWriter writer;


    string path = Server.MapPath("~/App_Data");


    writer = System.IO.File.CreateText(path+"/abc.txt");


    writer.WriteLine("abc");


    writer.Close();




    Vikram

    DiscountASP.NET
    www.DiscountASP.NET
     
  3. Bruce

    Bruce DiscountASP.NET Staff

    by default, your asp.net application should have write permission to all directories within your site root.


    Bruce

    DiscountASP.NET
    www.DiscountASP.NET
     
  4. Works great! Thanks for the tip.
     

Share This Page