Search code examples
c#asp.netintranetstreamwriter

Write a file to desktop of current user in C# asp.net


if i have this code, this creates a problems if other user that dont have acces to the network share tryes to run the method. How can i make this method write the file to the current users desktop?

        private void skriveTilFil()
        {
            StreamWriter writer = new StreamWriter(@"\\192.168.1.2\tmp\script.vbs");
            writer.WriteLine(scripttbx.Text);

            writer.Dispose();
        }

Solution

  • You can do it in an intranet environment by altering permissions/policies. You have to give the appropriate permissions to your ASP.NET application through IIS/Active Directory to the shares.