Working with "Paths" in C#

using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ProTestService
{
    class Program
    {
         static void Main(string[] args)
         {
             string path = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase);
             path = Path.Combine(path.Replace("file:\\", ""), "test.txt");
             using (StreamWriter newTask = new StreamWriter(path, true))
             {
                  newTask.WriteLine("ProTestService calisma zamani--> " +DateTime.Now.ToString());
             }
         }
     }
}


Comments

Popular posts from this blog

Solution for "Can not obtain Oracle client information from registry"

Solution for the fault: "System.Diagnostics.Process.Start is not working on IIS, but working on ASP.NET Development Server"

Getting Umbraco Content - IPublishedContent vs IContent vs Node vs Document