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 8042509
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T04:36:12+00:00 2026-06-05T04:36:12+00:00

I am using the approach below to handle 404 errors on my sites. This

  • 0

I am using the approach below to handle 404 errors on my sites. This has worked for a long time but suddenly within the last month I am getting a “Handle is not initialized” exception with a number of sites on our dedicated server (some still work, and on development machine it works). Anyone have any thoughts?

<system.webServer>
  <modules runAllManagedModulesForAllRequests="true"/>
  <httpErrors existingResponse="Replace">
    <remove statusCode="500" subStatusCode="-1"/>
    <remove statusCode="404" subStatusCode="-1"/>
    <error statusCode="404" prefixLanguageFilePath="" path="/default.aspx" responseMode="ExecuteURL"/>
    <error statusCode="500" prefixLanguageFilePath="" path="/error.aspx" responseMode="ExecuteURL"/>
  </httpErrors>
</system.webServer>

On default.aspx page:

protected void Page_PreRender(object sender, EventArgs e)
{
  if (!Page.IsPostBack && Request.Url.ToString().Contains("?404;"))
  {
    HttpContext.Current.RewritePath("~/");
    Page.Header.Controls.AddAt(0, new LiteralControl("<base href='" + Request.Url.Scheme + "://" + Request.Url.Authority + "'/>"));
    Response.StatusCode = 404;
    Util.DisplayAlert("The page you are looking for no longer exists. If you navigated to this page by clicking a link within this site please <a href='/contact.aspx'>contact us</a> to let us know.");
  }
}

Exception details:

Exception information: 
    Exception type: InvalidOperationException 
    Exception message: Handle is not initialized.
   at System.Runtime.InteropServices.GCHandle.FromIntPtr(IntPtr value)
   at System.Web.Hosting.PipelineRuntime.GetManagedPrincipalHandler(IntPtr pRootedObjects)
   at System.Web.Hosting.UnsafeIISMethods.MgdGetPrincipal(IntPtr pHandler, IntPtr& pToken, IntPtr& ppAuthType, Int32& pcchAuthType, IntPtr& ppUserName, Int32& pcchUserName, IntPtr& pManagedPrincipal)
   at System.Web.Hosting.IIS7WorkerRequest.GetUserPrincipal()
   at System.Web.Hosting.IIS7WorkerRequest.SynchronizeVariables(HttpContext context)
   at System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context)
  • 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-05T04:36:14+00:00Added an answer on June 5, 2026 at 4:36 am

    Levi: We have tracked down the root cause and are queuing a fix.

    Andrew McLachlan Confirmed as fixed in .NET 4.5 RC

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

Sidebar

Related Questions

I was using this approach to make the background of my OpenGL application transparent
I'm using this approach to store data in a global array hosting an http
So, I'm using this approach to be able to drag an image: Dragging an
I'm using a naive approach to this problem, I'm putting the words in a
I am sorry if this has been asked already, but I have been looking
I found an efficient code for adding unique items using the below approach: int[]
[UPDATE] Chosen approach is below, as a response to this question Hi, I' ve
I've implemented Zoom/Pinch using the approach said in android pinch zoom How can I
I was reading today about OOCSS which says by using that approach have 2
I implement a Singleton using the enum approach: public enum Singleton { INSTANCE; public

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.