Hello all:
I have an ASP.Net web page that is my login page to an application. It has a "Login" button that validates the user account details and then calls ClientScript.RegisterClien
tScriptBlo
ck() to open another .ASPX page containing my actual application window. It does this using javascript and suppresses all the IE user controls such as the address bar and other tool bars. I clear the password entry field on the login page, so that the user does not simply hit the "Login" button again to login into the website.
This all works fine when I login into the site, just as I intended. My problem is three-fold, but related.
1) If the user closes the application window so that they are back on the login page, and then hits the "Refresh" button on Internet Explorer, they get a prompt saying "To display the webpage again, IE needs to ersend the information you've previously submitted". If they hit the "Retry" button on that pop-up message, they are automatically logged into the site without having to re-enter the login password.
2) If the user closes the application window (returning them to the login window) and then navigates to another web page (such as
www.experts-exchange.com) then hits the "back" button to return to my login page, the login page appears, but my applicaiton window also pops open again without the user having entered their password or pressing the "Login" button.
3) If the user switches from the application window (so that it is still open, but in the background) back to the login page and either refreshes or navigates away and back, a second copy of the application window is opened.
I think the problem has something to do with the way that the "RegisterClientScriptBlock
() API works (unfortunately, this is not my code and the guys that wrote it no longer works here any more). On the "OnClick" event in the login2.aspx.cs code behind code, I call RegisterClientScriptBlock(
) as follows:
ClientScript.RegisterClien
tScriptBlo
ck(this.Ge
tType(), "redirect", "<script language=\"javascript\" type=\"text/javascript\">w
indow.open
( 'Default.aspx', '_blank', 'resizable=yes,menubar=no,
toolbar=no
,location=
no,scrollb
ars=yes,st
atus=yes,w
idth=1024,
height=768
,left=10,t
op=10');</
script>");
After the application page is displayed, if I look at the source for the login page, I noticed that there are three new sections added:
There is the viewstate section:
<div><input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="/wEPDwUKLTg4ODg2NjU
5MA9kFgICA
Q9kFgICCQ8
PFgIeBFRle
HRlZGRkmGv
+kbngmmKxf
TVrZrAZlxp
rlg4=" /></div>
The new javascript
<script language="javascript" type="text/javascript">win
dow.open('
Default.as
px', '_blank', 'resizable=yes,menubar=no,
toolbar=no
,location=
no,scrollb
ars=yes,st
atus=yes,w
idth=1024,
height=768
,left=10,t
op=10');</
script>
and finally the event validation section:
<div><input type="hidden" name="__EVENTVALIDATION" id="__EVENTVALIDATION" value="/wEWBQL88ZOWDgL7h7X
bDwKF+9bXB
QLKw6LdBQK
C3IeGDOy02
aq/oOP3fpd
cqXCX9/j+K
mSw" /></div>
Is there some way to clear this code or Deregister it? Or is there an event I can use to tell if I am in a page refresh or reload scenario (I know there is a "Page_Load" event being processed, are there other events that I could be monitoring?
Any help would be greatly appreciated.
Start Free Trial