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

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

jsf - "PropertyNotWritableException: Illegal Syntax for Set Operation" error when setting value in bean -

laravel - Undefined property: Illuminate\Pagination\LengthAwarePaginator::$id (View: F:\project\resources\views\admin\carousels\index.blade.php) -