Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9220821
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T03:26:17+00:00 2026-06-18T03:26:17+00:00

I add custom error exception in Global.asax. It works on debug mode but when

  • 0

I add custom error exception in Global.asax. It works on debug mode but when I publish it in IIS 7.0 it does not work:
Global.asax:

  void Application_Error(object sender, EventArgs e)
    {
    // Code that runs when an unhandled error occurs
        //Ramezani V4.5: Change0002 29-08-91        
        if (Context.AllErrors[0].InnerException != null)
        {
            try
            {
                bool IsValid = (Session["ExceptionHandler"] == null);
                ArisFramWork.ExceptionHandler handler = new ArisFramWork.ExceptionHandler(Request.AppRelativeCurrentExecutionFilePath, (Context.AllErrors[0] == null ? new Exception("No Error Found") : Context.AllErrors[0]));
                Session["ExceptionHandler"] = handler;
                string redirectURL = (IsValid ? Request.AppRelativeCurrentExecutionFilePath : "~/ExceptionHandler.aspx");
                Response.Redirect((Request.QueryString.Count == 0 ? redirectURL : redirectURL + "?" + Request.QueryString.ToString()));    
            }
            catch
            {
                Session["ExceptionHandler"] = null;
            }
        }
        else
        {
            Response.Redirect("~/FileAccess.aspx");
        }
    }
 void Application_Start(object sender, EventArgs e)
    {
        FastReport.Utils.Config.WebMode = true;
        // Code that runs on application startup
        //Ramezani V4.5: Change0002 29-08-91       
        //if (Context.Handler is IRequiresSessionState || Context.Handler is IReadOnlySessionState)       
            Session["ExceptionHandler"] = null;
    }

In ExceptionHandler.aspx:

protected void Page_Load(object sender, EventArgs e)
    {
        try
        {
            publicclass.MessageBox("Hello ExceptionHandler", this);
            if (Session["ExceptionHandler"] != null)
            {
                if(ExceptionHandlerBulletedList.Items.Count==1)
                    ExceptionHandlerBulletedList.Items.RemoveAt(0);
                List<ArisFramWork.ExceptionHandler> ExecutionCollection = (List<ArisFramWork.ExceptionHandler>)Session["ExceptionHandler"];
                if (ExecutionCollection.Count < 1)
                {
                    Page.ClientScript.RegisterClientScriptBlock(Page.GetType(), "CloseForm", "window.close();", true);
                    return;
                }       
                .....
                Session["ExceptionHandler"] = null;
            }
        }
        catch (Exception exception)
        {
            Page.ClientScript.RegisterClientScriptBlock(Page.GetType(), "CloseForm", "window.close();", true);
        }
    }

When I run website in debug Mode via Visual Studio 2010 it is work but it does not redirect to ExceptionHandler.asax in Publish Mode

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T03:26:18+00:00Added an answer on June 18, 2026 at 3:26 am

    This is because global.asax file is not published. Manually copy that file into your published folder.

    If this is a web application project then you can set global.asax file property to be content. Unfortunately if it is website then you have to manually do it.

    I am still breaking my head how to include global.asax into publish list. No answer yet.

    global.asax works on local computer but not after i publish to server

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a WCF/REST Web Service that I'm trying to add a global exception
Currently, we are doing error handling via Application_Error in global.asax.vb : Sub Application_Error(ByVal sender
I'm trying to add a custom property which is a guid, but it gives
I need to add custom validator for comparing two dates - start date and
How to add custom field into MarketPress (Wordpress)? I want to add 2 custom
I'd like to add custom controls to the mediaPlayer control view much as this
I want to add custom jump list entries to my application in Windows 7.
I am trying to add custom icons to a Shared Add-in for Microsoft Word.
is it possible to add custom data to the results so it can be
I would like to add custom attributes to a MySQL table which I can

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.