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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T07:08:24+00:00 2026-06-05T07:08:24+00:00

I have an ASP.NET 4.0 application that uses CrossPagePostback. I just noticed that my

  • 0

I have an ASP.NET 4.0 application that uses CrossPagePostback. I just noticed that my originating page is being loaded twice and I can’t find the reason why. Here is the general logic:

BasePage.vb:

Public Class BasePage
    Inherits System.Web.UI.Page

Protected Overrides Sub OnPreInit(e As System.EventArgs)
    If IsCrossPagePostBack Then Exit Sub
    ...
    Common code
    ...
    MyBase.OnPreInit(e)
End Sub

Protected Overrides Sub OnInit(e As System.EventArgs)
    If IsCrossPagePostBack Then Exit Sub
    ...
    Common code
    ...
    MyBase.OnInit(e)
End Sub

Protected Overrides Sub OnLoad(e As System.EventArgs)
    If IsCrossPagePostBack Then Exit Sub
    ...
    Common code
    ...
    MyBase.OnLoad(e)
End Sub

End Class

Page1.vb.aspx:

Public Class _Page1
    Inherits BasePage

Private Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load
    ...
    Page1 specific code
    ...
End Sub

End Class

Page2.vb.aspx:

Public Class _Page2
    Inherits BasePage

Private Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load
    ...
    Page2 specific code
    ...
End Sub

End Class

In Page1.aspx I have an ASP LinkButton with PostBackUrl set to Page2.aspx. I set breakpoints in OnPreInit, OnInit and OnLoad in BasePage.vb. When the LinkButton is clicked in Page1.aspx, all 3 page events fire for Page1.aspx – IsCrossPagePostBack=True, which is what I expect for the originating page. Then all 3 page events fire for Page2.aspx and IsCrossPagePostback=False which is again expected.

I would expect both pages to be done firing these page events at this point. I can even see that Page2.aspx has rendered and is visible in my browser, but for some reason Page1.aspx page events are once again fired and this time IsCrossPagePostback=False which allows undesired code to run for the originating page.

If you weren’t setting breakpoints and debugging this code you’d never know it was happening. There aren’t any noticable adverse effects from this happening, except that it’s costing processing time and I KNOW it’s wrong. I just can’t determine what’s causing Page1.aspx to be loaded again after Page2.aspx is loaded.

In my Call Stack window there is no caller, only a single line containing the current Sub (OnPreInit, OnInit or OnLoad).

I’ve traced through the code step by step. I get to the point that Page2.aspx is fully loaded and then end up in the page event for Page1.aspx again.

I also have a LinkButton control in Page2.aspx that has its PostBackUrl set for Page1.aspx – yet don’t have this problem.

Does anyone know what might cause this or how to debug it? I’ve seen a few posts that say empty img tags will cause it, but that’s not the problem here.

EDIT:

After an all-nighter of debugging and research, I’ve determined that my originating CrossPagePostback problem is in fact being caused by an IMG tag with a missing image. This is a big problem for me as the IMG SRC= URL is coming from a data received in a REST response I have no control over.

The REST response contains lots of data, some of which are URLs to images relating to a product. The images are essential to the page information. There are millions of products and it just happens that I noticed this problem on a product that has missing images. 99.99% of all the products have valid URLs for the images, so this is not going to be a common problem.

Yet, I really don’t want my originating page to be loading twice and I’d like to stop it from happening. Is this a bug that an originating page in a CrossPagePostback scenario will load twice if an IMG SRC= is broken in the target page?? Is there a fix??

Am going to do some more research, but figured I’d post a followup to my question right away. Anyone know of a solution/fix? I’ve read through similar posts here on SO that a missing image src will cause an originating CrossPagePostback page to load twice. The answer always seems to be either correct the src URL or make the image available so this don’t happen. Unfortunately, I don’t have either of those options – the img SRC is absolutely correct as is provided in the REST response received and the image is not mine, it’s supposed to be on a remote server as specified in the REST response.

Aside from checking the existence of each individual image before rendoring my page, I don’t know of a workaround. Checking for existance just isn’t a good option.

  • 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-05T07:08:25+00:00Added an answer on June 5, 2026 at 7:08 am

    After an all-nighter of debugging and research, I’ve determined that my originating CrossPagePostback problem is in fact being caused by an IMG tag with a missing image. This is a big problem for me as the IMG SRC= URL is coming from a data received in a REST response I have no control over.

    The REST response contains lots of data, some of which are URLs to images relating to a product. The images are essential to the page information. There are millions of products and it just happens that I noticed this problem on a product that has missing images. 99.99% of all the products have valid URLs for the images, so this is not going to be a common problem.

    Yet, I really don’t want my originating page to be loading twice and I’d like to stop it from happening. Is this a bug that an originating page in a CrossPagePostback scenario will load twice if an IMG SRC= is broken in the target page?? Is there a fix??

    Am going to do some more research, but figured I’d post a followup to my question right away. Anyone know of a solution/fix?

    Thanks.

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

Sidebar

Related Questions

I have an ASP.NET application that uses a master page configuration. What I'd like
Let say i have one asp.net application that is having some page that uses
I have just re-implemented an ASP.NET web application that uses NHibernate to use a
I have an ASP.NET application that uses a custom .NET library (a .DLL file).
I have a asp.net web application that uses C#. It logs in on a
I have an ASP.NET MVC application that uses Fluent NHibernate and AutoMapper. I am
I have an ASP.NET MVC application that uses Linq to SQL repositories for all
I have an ASP.NET (v2.0) web application that uses a reference to a SQL
I have an ASP.NET 3.0 application that works fine on one server. It uses
I have an application (ASP.NET MVC) that uses a Next New method to get

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.