0

In my ASP.NET app, Page_Load is fired on the old page when I navigate to a new one.

Example: Browser is at page1.aspx. Click a button that navigates to page2.aspx. Page_Load is fired for page1.aspx just before going to page2!

I already know about IsPostBack.

Is there some way (besides IsPostBack) that I can tell if this odd condition is occurring and safely ignore it rather than building out the entire page?

In other words, I'd like to avoid all the Page_Load code if the user is just leaving this page and going to another.

Ray White
  • 297
  • 4
  • 19
  • That's normal. Check the [ASP.NET Page Life Cycle](https://msdn.microsoft.com/en-us/library/ms178472%28v=vs.85%29.aspx). – dario Mar 06 '15 at 15:46
  • Normal? I'm burning time building a page that will never been seen. How is that normal? There must be a way to avoid that. – Ray White Mar 06 '15 at 16:27
  • Did you check the link? – dario Mar 06 '15 at 16:29
  • Yes, but I did not see the answer. I thought this forum was for answers, not links that may or may not have answers. Is there a simple answer to the question? – Ray White Mar 06 '15 at 16:30
  • The fact is that this is not a strange behavior, it's how ASP.NET works. You are probably doing something wrong. For example, if you just need to redirect to another page, use hyperlink instead. Anyway you better search before ask here. – dario Mar 06 '15 at 16:37

0 Answers0