Author: micahs | Posted on: 8/1/2008 12:40:12 PM | Views : 252

 i've created a custom error page that gets the error Server.Transfer-ed to it. However, when i go to get the innerexception (which has the preferred non-technical message), i always get a null reference error. How do you check for innerexceptions without causing an exception?
 my code
  
1 protected void Page_Load(object sender, EventArgs e)
2 {
3 HttpContext ctx = HttpContext.Current;
4 Exception exception = ctx.Server.GetLastError();
5 lblURL.Text = ctx.Request.Url.ToString();
6
7 Exception inn = exception.InnerException ?? null;
8 if (exception.InnerException != null)
9 lblMessag ...

Go to the complete details ...