finding the path of place that error happened in C# pages -


i want put method in catch {} send error ".log" file. put address of page , method error happened their. want me , tell me how can define "strerrorpath" , put on of method input .

 public static void senderrortopersonalerrormessage(exception ex,string strerrorpath ) {     string strerrormessage = string.format("error:{0} time:{1:yyy/mm/dd - hh:mm:ss},address:{2}", ex.message, system.datetime.now, strerrorpath);     system.io.streamwriter ostreamwriter = null;     string strpersonalerrormessagepath = "~/app_data/log/personalerrormessage.log";     string strpersonalerrormessagepathname = httpcontext.current.server.mappath(strpersonalerrormessagepath);     ostreamwriter = new system.io.streamwriter(strpersonalerrormessagepathname, true, system.text.encoding.utf8); }`enter code here` 

just use ex.source , ex.stacktrace show useful information exception.

you can read more stacktrace here


Comments

Popular posts from this blog

php - How to display all orders for a single product showing the most recent first? Woocommerce -

asp.net - How to correctly use QUERY_STRING in ISAPI rewrite? -

angularjs - How restrict admin panel using in backend laravel and admin panel on angular? -