I’m using ASP.NET 4.0 with a LoginStatus control in a Master page. When the status is Login and I click the link, the current page is attempted to be reloaded. I can see that IsPostBack=True.
If I use Set Next Statement to avoid my code in Page.Load the redirect to Login.aspx goes without a hitch, otherwise the current page tries to reload and for some reason it fails.
From Page.Load, what is the best way to detect that LoginStatus has been clicked? A click event handler won’t work since it fires too late. IsPostBack won’t work either (on its own). I do have a BaseMasterPage class that is inherited by my Master page, but again, the Master page loads after Page.Load in all of my pages.
Do I have to handle this click in every one of the pages that use this Master page?
Btw, I also have a BasePage class that all of my pages inherit. I’m just not sure how to detect that LoginStatus has been clicked – and if it has, how to handle it. Would I force a Redirect? That seems like overkill…
The problem here was being caused by an
<img src=that did not exist on a remote server. This was causing my page to load twice. The first time through,IsPostBackwould beTrue. The second time through it wasFalse.This is why I was unable to figure out why the redirect wasn’t happening on its own. I’m marking this question as answered even though I should probably just delete the whole question. :S