Tuesday, October 22, 2013

Unhandle Exception with error Error.aspx and Application_Error

Error.aspx
    <form id="form1" runat="server">
    <div>
    <center>
  <div class="ContentHead">ERROR</div><br /><br />
  <asp:Label ID="Label_ErrorFrom" runat="server" Text="Label"></asp:Label><br /><br />
  <asp:Label ID="Label_ErrorMessage" runat="server" Text="Label"></asp:Label><br /><br />
</center>
    </div>
    </form>
..........
protected void Page_Load(object sender, EventArgs e)
        {
            Label_ErrorFrom.Text = Request["Err"].ToString();
            Label_ErrorMessage.Text = Request["InnerErr"].ToString();

        }

Global.asax
       void Application_Error(object sender, EventArgs e)
        {
            Exception myEx = Server.GetLastError();
            String RedirectUrlString = "~/Error.aspx?InnerErr=" +
                myEx.InnerException.Message.ToString() + "&Err=" + myEx.Message.ToString();
            Response.Redirect(RedirectUrlString);
            // Code that runs when an unhandled error occurs

        }

Related Posts:

  • Add Item Category <%@ Page Title="Add New Category" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="Add_ItemCategory.aspx.cs" Inheri… Read More
  • Add Item Sub Category <%@ Page Title="Add New Sub Category" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="Add_ItemSubCategory.aspx.cs"… Read More
  • Stored Procedures ALTER PROCEDURE [dbo].[usp_SetItemCategory]     @ncName            nvarchar(100),  … Read More
  • ClearText         private void Cleartxt()         {       … Read More
  • Notification <%@ Control Language="C#" AutoEventWireup="true" CodeBehind="Notification.ascx.cs" Inherits="Watson.UserControl.Notification" %> <div align=… Read More

0 comments:

Post a Comment

Popular Posts

Recent Posts

Text Widget

Powered by Blogger.

Find Us On Facebook

Flickr Images

Recent Posts

Video Of Day

Random Posts

Facebook

Random Posts

Advertising

Popular Posts