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

  • Home
  • SEARCH
  • 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 3221180
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T15:50:48+00:00 2026-05-17T15:50:48+00:00

I have error handling in Application_Error event of globals.asax file. Inside this event, I’m

  • 0

I have error handling in Application_Error event of globals.asax file. Inside this event, I’m using Response.Redirect(~errorview.aspx) method, for redirection to site which is able to handle errors in user friendly way.

Everything works fine, unless exception is rising in Application_Start event. When error occurs there, my application gets trapped in infinite loop with the Application_Error method hit repeatedly. What is more, the page I’m redirecting to never gets hit. Changing Response.Redirect(~errorview.aspx) method to Response.Redirect(~errorview.aspx, false) changes nothing.

The good news is, when Response.Redirect(~errorview.aspx) has been replaced with Server.Transfer(~errorview.aspx), errorview.aspx page succesfully gets hit.

The side effect now is not loading CSS, and errorview.aspx page looks ugly. What is more, the CSS is not loaded only when exception occurs in Application_Start event. Exceptions thrown from any other place don’t make the CSS mess.

How I can handle this problem in correct way, and why the CSS is missing in the one particular situation ? What is the appropriate way of handling errors in my case ?

UPDATE

For CSS loading, I’m using this:

<link href="~/Css/Layout/style.css" type="text/css" rel="stylesheet" 
      runat="server" ID="_uid" />

error page I’m transfering from: http://localhost/APP/Pages/Module/Pages/ErrorView.aspx

css folder path: http://localhost/APP/Pages/Module/CSS/Layout/style.css

Thanks for any clues in advance. Regards.

  • 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-05-17T15:50:48+00:00Added an answer on May 17, 2026 at 3:50 pm

    If you’re getting exceptions during Application_Start, you have bigger problems than trying to get CSS to load in the error page. Application_Start is intended as a bootstrapper for the Web site to initialize everything. If you can’t successfully initialize the application, you probably won’t be able to service any requests. (You shouldn’t be publishing an application to a production environment when it is known to have exceptions in the Application_Start anyway.)

    Ultimately, what Server.Transfer is doing is simply switching from processing the current path to processing the new path. The request context is not modified, so any relative references in the new path are relative to the original request. If an exception happens in Application_Start, there is no original request. (Requests aren’t handled by Application_Start. A request can cause Application_Start to be invoked, but it won’t know anything about the request.) That’s probably why Server.Transfer from an Application_Start exception doesn’t load the CSS – there’s no original request context.

    Also, it’s generally a better idea to have a static html-only error page. If there’s an error caused by some ASP.NET processing in IIS, then it’s likely that an error page that is also processed by the ASP.NET will suffer the same error, possibly causing an infinite loop (the error page redirects to the error page because there was an error – lather, rinse, repeat). (This is the infinite loop situation that you experienced.) Eventually, good browsers will notice this and stop the loop, but you still have the runaway request cycle. If you use a static html-only page, then you prevent ASP.NET from ever attempting to process the request. (It’s usually cleaner, too, as you should have a very simple, straightforward error page that displays to the visitor and have all the error trapping and notifications handled behind the scenes.)

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

Sidebar

Related Questions

I have implemented global error handling in my global.asax file to handle any exceptions
I have VB6 application , I want to put some good error handling finction
I have an error handling method in my ApplicationController: rescue_from ActiveRecord::RecordNotFound, :with => :not_found
I have a website which uses the custom 404 error handling in PHP/Apache to
I get this error:- You have an error in your SQL syntax; check the
Advance New Year Wishes to All. I have an error log file with the
I've tried this both with and without the 'ExceptionType' parameter. I have an Error.aspx
I have a question regarding handling errors in a J2EE application. Our current application
We have an error that we can't seem to find and don't have the
I have an error occuring frequently from our community server installation whenever the googlesitemap.ashx

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.