سؤال

I'm trying to write my errors into the text file in my MapPath. But i have a problem it is :

path = Server.MapPath("~/emails.txt");

Actually Server is in System.Web.UI.Page namespace and I want to Use it in my cs file which has no aspx file... I mean it is CodeFile in AppCode; How can I write to file from cs CodeFile?

هل كانت مفيدة؟

المحلول

Use HttpContext.Current.Server.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top