<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://forums.asp.net/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Web Forms</title><link>http://forums.asp.net/18.aspx</link><description>All about building ASP.NET Pages - server controls, events, validation, etc.</description><dc:language>en</dc:language><generator>CommunityServer 2007 SP1 (Build: 20510.895)</generator><item><title>Re: How do I get the function and page name?</title><link>http://forums.asp.net/thread/1140687.aspx</link><pubDate>Tue, 13 Dec 2005 15:57:01 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:1140687</guid><dc:creator>IKoradia</dc:creator><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/1140687.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=18&amp;PostID=1140687</wfw:commentRss><description>I'm not sure this will get you the line number you are looking for but here's a way:&lt;br /&gt;&lt;br /&gt;Dim st As New StackTrace(ex)&amp;nbsp;&amp;nbsp;  'create a stacktrace from your exception&lt;br /&gt;st.GetFrame(0).GetFileLineNumber() 'get the line number&lt;br /&gt;&lt;br /&gt;Also, I don't think this would work in release mode since the line number (among other information) is retrieved from the debug symbols that are created only when in debug mode. Anyway, you can give it a shot.&lt;br /&gt;&lt;br /&gt;hope that helps,&lt;br /&gt;Imran.&lt;br /&gt;</description></item><item><title>Re: How do I get the function and page name?</title><link>http://forums.asp.net/thread/1140501.aspx</link><pubDate>Tue, 13 Dec 2005 14:10:18 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:1140501</guid><dc:creator>raynkel</dc:creator><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/1140501.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=18&amp;PostID=1140501</wfw:commentRss><description>&lt;p&gt;Great thanks, anyone know how to get the line number?&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Thanks&lt;/p&gt;</description></item><item><title>Re: How do I get the function and page name?</title><link>http://forums.asp.net/thread/1139749.aspx</link><pubDate>Mon, 12 Dec 2005 22:13:52 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:1139749</guid><dc:creator>IKoradia</dc:creator><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/1139749.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=18&amp;PostID=1139749</wfw:commentRss><description>For the function name, you could use:&lt;br /&gt;&lt;br /&gt;Dim mb As System.Reflection.MethodBase = System.Reflection.MethodBase.GetCurrentMethod()&lt;br /&gt;Dim FunctionName As String = mb.Name&lt;br /&gt;&lt;br /&gt;hope that helps,&lt;br /&gt;Imran.&lt;br /&gt;&lt;br /&gt;</description></item><item><title>Re: How do I get the function and page name?</title><link>http://forums.asp.net/thread/1139700.aspx</link><pubDate>Mon, 12 Dec 2005 21:21:04 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:1139700</guid><dc:creator>raynkel</dc:creator><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/1139700.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=18&amp;PostID=1139700</wfw:commentRss><description>&lt;p&gt;That has information about getting the Web page name and such. Part of what I need. Still need to get the actual function I am in &lt;/p&gt;
&lt;p&gt;This seems to work.&lt;/p&gt;&lt;font size=2&gt;
&lt;p&gt;&lt;font color=#0000ff size=2&gt;Dim&lt;/font&gt;&lt;font size=2&gt; d &lt;/font&gt;&lt;font color=#0000ff size=2&gt;As&lt;/font&gt;&lt;font size=2&gt; &lt;/font&gt;&lt;font color=#0000ff size=2&gt;String&lt;/font&gt;&lt;font size=2&gt; = Mid(ex.StackTrace.ToString, ex.StackTrace.LastIndexOf(vbNewLine) + 3, ex.StackTrace.Length)
&lt;p&gt;&lt;font color=#0000ff size=2&gt;Dim&lt;/font&gt;&lt;font size=2&gt; c &lt;/font&gt;&lt;font color=#0000ff size=2&gt;As&lt;/font&gt;&lt;font size=2&gt; &lt;/font&gt;&lt;font color=#0000ff size=2&gt;String&lt;/font&gt;&lt;font size=2&gt; = Mid(d, d.IndexOf(&lt;/font&gt;&lt;font color=#008080 size=2&gt;"."&lt;/font&gt;&lt;font size=2&gt;) + 2, d.Length)
&lt;p&gt;&lt;font color=#0000ff size=2&gt;Dim&lt;/font&gt;&lt;font size=2&gt; LineNum &lt;/font&gt;&lt;font color=#0000ff size=2&gt;As&lt;/font&gt;&lt;font size=2&gt; &lt;/font&gt;&lt;font color=#0000ff size=2&gt;Integer&lt;/font&gt;&lt;font size=2&gt; = Mid(ex.StackTrace.ToString, ex.StackTrace.LastIndexOf(&lt;/font&gt;&lt;font color=#008080 size=2&gt;":"&lt;/font&gt;&lt;font size=2&gt;) + 6, ex.StackTrace.Length) - 1
&lt;p&gt;&lt;font color=#0000ff size=2&gt;Dim&lt;/font&gt;&lt;font size=2&gt; FunctionName &lt;/font&gt;&lt;font color=#0000ff size=2&gt;As&lt;/font&gt;&lt;font size=2&gt; &lt;/font&gt;&lt;font color=#0000ff size=2&gt;String&lt;/font&gt;&lt;font size=2&gt; = Mid(c, c.IndexOf(&lt;/font&gt;&lt;font color=#008080 size=2&gt;"."&lt;/font&gt;&lt;font size=2&gt;) + 2, c.IndexOf(&lt;/font&gt;&lt;font color=#008080 size=2&gt;"()"&lt;/font&gt;&lt;font size=2&gt;) - 7)&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font size=2&gt;&lt;/font&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;font size=2&gt;Am&amp;nbsp;hoping for a more direct route.&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font size=2&gt;&lt;/font&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;font size=2&gt;Thanks&lt;/font&gt;&lt;/p&gt;&lt;/font&gt;&lt;/p&gt;&lt;/font&gt;&lt;/p&gt;&lt;/font&gt;&lt;/p&gt;&lt;/font&gt;</description></item><item><title>Re: How do I get the function and page name?</title><link>http://forums.asp.net/thread/1139564.aspx</link><pubDate>Mon, 12 Dec 2005 19:30:25 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:1139564</guid><dc:creator>eramseur</dc:creator><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/1139564.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=18&amp;PostID=1139564</wfw:commentRss><description>Check out this page : &lt;a href="http://west-wind.com/weblog/posts/269.aspx"&gt;http://west-wind.com/weblog/posts/269.aspx&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
There is more if you just do a " get current page asp.net" search.&lt;br /&gt;
&lt;br /&gt;</description></item><item><title>How do I get the function and page name?</title><link>http://forums.asp.net/thread/1139486.aspx</link><pubDate>Mon, 12 Dec 2005 18:47:00 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:1139486</guid><dc:creator>raynkel</dc:creator><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/1139486.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=18&amp;PostID=1139486</wfw:commentRss><description>How do I programatically get the page name and function My code is running? &lt;br /&gt;
&lt;br /&gt;
I use this code:&lt;br /&gt;
&lt;font size="2"&gt;&amp;nbsp; Catch ex As Exception&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim cookie As HttpCookie = New HttpCookie("Error")&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; cookie.Value = ex.Message&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Response.Cookies.Add(cookie)&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim ThisPage As String = "SavingsTracker.aspx"&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim FunctionName As String = "GetUsersAgency"&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim URLString As String =
"ErrorPopup.aspx?Page=" &amp;amp; ThisPage &amp;amp; "&amp;amp;Function=" &amp;amp;
FunctionName&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Response.Redirect(URLString)&lt;br /&gt;
&lt;br /&gt;
&lt;font size="3"&gt;To capture errors during testing. I use it quite a few times and having to declare the function name and Page is tedious.&lt;br /&gt;
I write the error to a cookie because some times it is two lines and query strings no likey.&lt;br /&gt;
&lt;br /&gt;
Can these values be gotten? Also what about line number? That would be excellant!!&lt;br /&gt;
&lt;br /&gt;
&lt;/font&gt;&lt;br /&gt;
&lt;/font&gt;&lt;br /&gt;</description></item></channel></rss>