Quantcast
Channel: SharePoint 2013 - Development and Programming forum
Viewing all articles
Browse latest Browse all 7589

How to know method name dynamically with sender or EventArgs object

$
0
0

Hello All,

I am working in ASP.NET. I wanna log method name in log file whenever that method is executed. e.g.

protected void Page_Load(object sender, EventArgs e)
{
            Trace.Log("Page_Load start");
            ...
            ...
            ...
            Trace.Log("Page_Load end");
}

protected void Method2(object sender, EventArgs e)
{
            Trace.Log("Method2 start");
            ...
            ...
            ...
            Trace.Log("Method2 end");
}

Trace.Log() is use to log my string in log files at D:\. Now, here I have hard coded Method name in Trace.Log(). But, now I want to fetch method name via c# code. Can we achieve it via sender or EventArgs object?

Please assist.


Thanks, Chintan


Viewing all articles
Browse latest Browse all 7589

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>