R – ASP.NET Page calls an additional aspx page after loading

asp.netloadmaster-pagesvb.net

To keep things simple, we have a few aspx pages…

Page1.aspx – resets Session information.
Page2.aspx – Search form with results and sets Session variables.
Page3.aspx, Page4.aspx, Page5.aspx – require Session variables set on Page2.aspx

What we're finding is that as Page2.aspx loads and setting the Session variables, Page1.aspx is being called and resetting the Session. However, Page1.aspx shows up in the browser, not Page2.aspx. We were only able to find this happening as we stepped through the code and put break points in the Page_Load events for Page1.aspx and Page2.aspx and were surprised to see Page2.aspx being processed as soon as Page1.aspx stopped processing on the server.

Possibly useful info… we do use a Master page and there are links to Page1.aspx in the Master page. Other than that, I can not find any references to Page1.aspx in the code base.

update:
It may be due to authentication? It appears that when I access Page2.aspx, the server is possibly authenticating again on Page1.aspx? Is that typical?

Best Answer

Thanks for the tip Andrew.

We figured out what was going on... Page1.aspx in the application is really Default.aspx. On Page2.aspx, another developer put a img tag on the page that did not have src property defined. So when Page2.aspx executed, it was looking for an image located at the web site's root level, this then triggered the code on Default.aspx (Page1) and wipe away the session.

Overall it looked something like this...

On Page2.aspx

<img src=""> <!-- this ended up triggering a call to Default.aspx, wiping the session -->

Hopefully that helps out someone else.

Related Topic