Community discussion forum

How Write a Text File in ASP.Net Website at runtime

  • 1 year ago

    Hai Friends

    I have a problem when i try to write a texfile at run time then an error is shown

    the error is  Access to the path 'c:\domains\myweb.com\wwwroot\admin\news.txt' is denied.

    am using asp.net with c# the code is working at desin time but not working internet

    the codei used

    string pth;

    pth = Server.MapPath(".").ToString();

    pth = pth + "\\news.txt";

    StreamWriter tw = new StreamWriter(pth);

    tw.Write( txtnews.Text.Trim() );

    tw.Close();

    help me please thanks in advance

     

  • 1 year ago

    Hi

     you need to provide a ASPNET account with write access to this folder [Recommended]

     otherwise try to "Everyone" write access to this folder

    "'c:\domains\myweb.com\wwwroot\admin"

    The follwoing links may also helpful for you

    http://www.velocityreviews.com/forums/t282579-access-to-the-path-is-denied.html
    http://www.element-it.com/Access-to-the-path-is-denied.aspx

    i hope this will solve your problem

    Good Luck

    Regards

    Hari K......

Post a reply

Enter your message below

Sign in or Join us (it's free).

Want to stay in touch with what's going on? Follow us on twitter!