473,322 Members | 1,408 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

Pop-up Window Coming back up. Message Box Problem

What I have is a message box that pops up. It is another browser window.
The code is a general function that you pass message, title and a key to.
The box works great except, that if you are on a page, get the message box,
then click ok on the message box go to another page and then back to the
first page. The message box pops up again. It is almost like the history
or cache still has information about the state and that it knows that
message box was popped up shortly before going to the other page and back.

I was looking for a way to stop this.

Example, I check a result and if ok display a message box. then when the
user clicks ok on the message box and fix the result then I redirect them to
another page. Now if they hit the back button then the Message box pops
back up as if it was still in the cache, as if it got loaded again.
If lnResult <> 0 Then
lblMsg.Text = " Authorization Code not valid, check the
company correct code."
ONSMsgBox("No matching Company Authorization Code",
"Error Getting the company info", "btnEnter_Click")
Else
Session("CompanyList") = lobjCompanyInfos
lblMsg.Text = ""

Try
Response.Redirect("information.aspx")
Catch ex As System.Threading.ThreadAbortException
'Eat the exception, Microsoft bug with Redirect
End Try
End If
Below is the code for the message box function that is on the page, the call
it makes to Page. RegisterStartupScript to create the pop up message box,
the HTML code for the message page, and the load of the message page.

Public Sub ONSMsgBox(ByVal psMsg As String, ByVal psTitle As String,
ByVal psKey As String)
Dim lutMsgBox As MsgBox
Try
lutMsgBox.Message = psMsg
lutMsgBox.Title = psTitle
Session("MessageBox") = lutMsgBox

Page.RegisterStartupScript(psKey, DisplayMessage)
Catch ex As Exception
WriteException("ONSMsgBox Exception", ex.Message &
ex.StackTrace)
End Try
End Sub
Inside this I call display message that calls my ASP.Net message box form
and creates it
Public Function DisplayMessage() As String
Dim lobjPopupScript As String = "<script language='javascript'>" & _
"window.open('ONSMsgBox.aspx', 'ONSMsgBoxPopUp', 'Top=100,
Left=100, " & _
"width=450, height=175, menubar=no, resizable=no')" & _
"</script>"
Return lobjPopupScript
End Function
Now the ONSMsgBox is simple page:
<%@ Page Language="vb" AutoEventWireup="false"
Codebehind="ONSMsgBox.aspx.vb" Inherits="OrionWebSite.ONSMsgBox" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<title runat="server" id="MsgBoxTitle">ONSMsgBox</title>
<meta content="Microsoft Visual Studio .NET 7.1" name="GENERATOR">
<meta content="Visual Basic .NET 7.1" name="CODE_LANGUAGE">
<meta content="JavaScript" name="vs_defaultClientScript">
<meta content="http://schemas.microsoft.com/intellisense/ie5"
name="vs_targetSchema">
<LINK href="orion_styles.css" type="text/css" rel="stylesheet">
</HEAD>
<body MS_POSITIONING="GridLayout">
<form id="Form1" method="post" runat="server">
<asp:label id="lblMsg" style="Z-INDEX: 101; LEFT: 24px; POSITION:
absolute; TOP: 24px" runat="server"
Width="416px" Height="88px" CssClass="bodytext">Label</asp:label><INPUT
style="Z-INDEX: 102; LEFT: 200px; WIDTH: 66px; POSITION: absolute; TOP:
120px; HEIGHT: 24px"
type="button" value="Close" onclick="javascript:window.close();"></form>
</body>
</HTML>
and the only code is in the page_load
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
'Put user code to initialize the page here
wutMsgBox = CType(Session("messageBox"), MsgBox)
MsgBoxTitle.InnerText = wutMsgBox.Title
lblMsg.Text = wutMsgBox.Message
End Sub

Nov 19 '05 #1
2 3266
the inline script to produce the messagebox is in the cached page. when the
user hits back, the script creates the popup again.

don't worry, winxp-sp2, will stop your popup code from running in the first
place, so this problem will go away.

-- bruce (sqlwork.com)
"Microsoft News" <Na**@coxinet.net> wrote in message
news:O7**************@TK2MSFTNGP15.phx.gbl...
| What I have is a message box that pops up. It is another browser window.
| The code is a general function that you pass message, title and a key to.
| The box works great except, that if you are on a page, get the message
box,
| then click ok on the message box go to another page and then back to the
| first page. The message box pops up again. It is almost like the history
| or cache still has information about the state and that it knows that
| message box was popped up shortly before going to the other page and back.
|
| I was looking for a way to stop this.
|
| Example, I check a result and if ok display a message box. then when the
| user clicks ok on the message box and fix the result then I redirect them
to
| another page. Now if they hit the back button then the Message box pops
| back up as if it was still in the cache, as if it got loaded again.
| If lnResult <> 0 Then
| lblMsg.Text = " Authorization Code not valid, check
the
| company correct code."
| ONSMsgBox("No matching Company Authorization Code",
| "Error Getting the company info", "btnEnter_Click")
| Else
| Session("CompanyList") = lobjCompanyInfos
| lblMsg.Text = ""
|
| Try
| Response.Redirect("information.aspx")
| Catch ex As System.Threading.ThreadAbortException
| 'Eat the exception, Microsoft bug with Redirect
| End Try
| End If
|
|
| Below is the code for the message box function that is on the page, the
call
| it makes to Page. RegisterStartupScript to create the pop up message box,
| the HTML code for the message page, and the load of the message page.
|
| Public Sub ONSMsgBox(ByVal psMsg As String, ByVal psTitle As String,
| ByVal psKey As String)
| Dim lutMsgBox As MsgBox
| Try
| lutMsgBox.Message = psMsg
| lutMsgBox.Title = psTitle
| Session("MessageBox") = lutMsgBox
|
| Page.RegisterStartupScript(psKey, DisplayMessage)
| Catch ex As Exception
| WriteException("ONSMsgBox Exception", ex.Message &
| ex.StackTrace)
| End Try
| End Sub
|
|
| Inside this I call display message that calls my ASP.Net message box form
| and creates it
| Public Function DisplayMessage() As String
| Dim lobjPopupScript As String = "<script language='javascript'>" &
_
| "window.open('ONSMsgBox.aspx', 'ONSMsgBoxPopUp', 'Top=100,
| Left=100, " & _
| "width=450, height=175, menubar=no, resizable=no')" & _
| "</script>"
| Return lobjPopupScript
| End Function
|
|
| Now the ONSMsgBox is simple page:
| <%@ Page Language="vb" AutoEventWireup="false"
| Codebehind="ONSMsgBox.aspx.vb" Inherits="OrionWebSite.ONSMsgBox" %>
| <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
| <HTML>
| <HEAD>
| <title runat="server" id="MsgBoxTitle">ONSMsgBox</title>
| <meta content="Microsoft Visual Studio .NET 7.1" name="GENERATOR">
| <meta content="Visual Basic .NET 7.1" name="CODE_LANGUAGE">
| <meta content="JavaScript" name="vs_defaultClientScript">
| <meta content="http://schemas.microsoft.com/intellisense/ie5"
| name="vs_targetSchema">
| <LINK href="orion_styles.css" type="text/css" rel="stylesheet">
| </HEAD>
| <body MS_POSITIONING="GridLayout">
| <form id="Form1" method="post" runat="server">
| <asp:label id="lblMsg" style="Z-INDEX: 101; LEFT: 24px; POSITION:
| absolute; TOP: 24px" runat="server"
| Width="416px" Height="88px"
CssClass="bodytext">Label</asp:label><INPUT
| style="Z-INDEX: 102; LEFT: 200px; WIDTH: 66px; POSITION: absolute; TOP:
| 120px; HEIGHT: 24px"
| type="button" value="Close"
onclick="javascript:window.close();"></form>
| </body>
| </HTML>
|
|
| and the only code is in the page_load
| Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
| System.EventArgs) Handles MyBase.Load
| 'Put user code to initialize the page here
| wutMsgBox = CType(Session("messageBox"), MsgBox)
| MsgBoxTitle.InnerText = wutMsgBox.Title
| lblMsg.Text = wutMsgBox.Message
| End Sub
|
|
|
Nov 19 '05 #2
True but does not answer my question. How do I clear or expire the cached
script of the page??
"bruce barker" <no***********@safeco.com> wrote in message
news:O6*************@TK2MSFTNGP09.phx.gbl...
the inline script to produce the messagebox is in the cached page. when
the
user hits back, the script creates the popup again.

don't worry, winxp-sp2, will stop your popup code from running in the
first
place, so this problem will go away.

-- bruce (sqlwork.com)
"Microsoft News" <Na**@coxinet.net> wrote in message
news:O7**************@TK2MSFTNGP15.phx.gbl...
| What I have is a message box that pops up. It is another browser
window.
| The code is a general function that you pass message, title and a key
to.
| The box works great except, that if you are on a page, get the message
box,
| then click ok on the message box go to another page and then back to the
| first page. The message box pops up again. It is almost like the
history
| or cache still has information about the state and that it knows that
| message box was popped up shortly before going to the other page and
back.
|
| I was looking for a way to stop this.
|
| Example, I check a result and if ok display a message box. then when
the
| user clicks ok on the message box and fix the result then I redirect
them
to
| another page. Now if they hit the back button then the Message box pops
| back up as if it was still in the cache, as if it got loaded again.
| If lnResult <> 0 Then
| lblMsg.Text = " Authorization Code not valid, check
the
| company correct code."
| ONSMsgBox("No matching Company Authorization Code",
| "Error Getting the company info", "btnEnter_Click")
| Else
| Session("CompanyList") = lobjCompanyInfos
| lblMsg.Text = ""
|
| Try
| Response.Redirect("information.aspx")
| Catch ex As System.Threading.ThreadAbortException
| 'Eat the exception, Microsoft bug with Redirect
| End Try
| End If
|
|
| Below is the code for the message box function that is on the page, the
call
| it makes to Page. RegisterStartupScript to create the pop up message
box,
| the HTML code for the message page, and the load of the message page.
|
| Public Sub ONSMsgBox(ByVal psMsg As String, ByVal psTitle As String,
| ByVal psKey As String)
| Dim lutMsgBox As MsgBox
| Try
| lutMsgBox.Message = psMsg
| lutMsgBox.Title = psTitle
| Session("MessageBox") = lutMsgBox
|
| Page.RegisterStartupScript(psKey, DisplayMessage)
| Catch ex As Exception
| WriteException("ONSMsgBox Exception", ex.Message &
| ex.StackTrace)
| End Try
| End Sub
|
|
| Inside this I call display message that calls my ASP.Net message box
form
| and creates it
| Public Function DisplayMessage() As String
| Dim lobjPopupScript As String = "<script language='javascript'>"
&
_
| "window.open('ONSMsgBox.aspx', 'ONSMsgBoxPopUp', 'Top=100,
| Left=100, " & _
| "width=450, height=175, menubar=no, resizable=no')" & _
| "</script>"
| Return lobjPopupScript
| End Function
|
|
| Now the ONSMsgBox is simple page:
| <%@ Page Language="vb" AutoEventWireup="false"
| Codebehind="ONSMsgBox.aspx.vb" Inherits="OrionWebSite.ONSMsgBox" %>
| <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
| <HTML>
| <HEAD>
| <title runat="server" id="MsgBoxTitle">ONSMsgBox</title>
| <meta content="Microsoft Visual Studio .NET 7.1" name="GENERATOR">
| <meta content="Visual Basic .NET 7.1" name="CODE_LANGUAGE">
| <meta content="JavaScript" name="vs_defaultClientScript">
| <meta content="http://schemas.microsoft.com/intellisense/ie5"
| name="vs_targetSchema">
| <LINK href="orion_styles.css" type="text/css" rel="stylesheet">
| </HEAD>
| <body MS_POSITIONING="GridLayout">
| <form id="Form1" method="post" runat="server">
| <asp:label id="lblMsg" style="Z-INDEX: 101; LEFT: 24px; POSITION:
| absolute; TOP: 24px" runat="server"
| Width="416px" Height="88px"
CssClass="bodytext">Label</asp:label><INPUT
| style="Z-INDEX: 102; LEFT: 200px; WIDTH: 66px; POSITION: absolute; TOP:
| 120px; HEIGHT: 24px"
| type="button" value="Close"
onclick="javascript:window.close();"></form>
| </body>
| </HTML>
|
|
| and the only code is in the page_load
| Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
| System.EventArgs) Handles MyBase.Load
| 'Put user code to initialize the page here
| wutMsgBox = CType(Session("messageBox"), MsgBox)
| MsgBoxTitle.InnerText = wutMsgBox.Title
| lblMsg.Text = wutMsgBox.Message
| End Sub
|
|
|

Nov 19 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Pedro | last post by:
Hi all, a friend using Windows wanted to send mail, but he got timeout errors after editing php.ini Mail section smtp = smtp.server.com sendmail_from = friend@server.com I realized that...
4
by: Roy Smith | last post by:
In the recent "transforming a list into a string" thread, we've been discussing the fact that list.pop() is O(1), but list.pop(0) is O(n). I decided to do a little timing experiment. To be sure,...
6
by: Will | last post by:
Hi, Sorry to be a pest... But I can figure this out. I'm pushing to a stack. then I need to check to see if the word is a palindrome. Is the code below correct? if so, how can I check the...
11
by: Vijay Kumar R Zanvar | last post by:
> In <pan.2004.04.22.04.06.05.969827@bar.net> "Mac" <foo@bar.net> writes: > > >Is it legal to declare errno after you've included errno.h? > > > >For example: > > > >#include<errno.h> > > >...
25
by: Nicholas Parsons | last post by:
Howdy Folks, I was just playing around in IDLE at the interactive prompt and typed in dir({}) for the fun of it. I was quite surprised to see a pop method defined there. I mean is that a...
7
by: Scott | last post by:
As said before I'm new to programming, and I need in depth explaination to understand everything the way I want to know it, call it a personality quirk ;p. With pop() you remove the last element...
4
by: j_depp_99 | last post by:
The program below fails on execution and I think the error is in my pop function but it all looks correct.Also could someone check my code as to why my print function is not working? I havent...
20
by: merrittr | last post by:
I need some C advice I want to read in string commands from a user when the user enters a \n I want to push it on the stac. Then at some point , if the user enters the word print pop off and print...
1
by: pbd22 | last post by:
Hi all. I am using styles to lock down the GUI until the user enters some info in a CSS/DIV pop box. If the user does now scroll before he clicks, the pop box is centered and the background...
0
by: Gabriel Genellina | last post by:
En Thu, 08 May 2008 09:24:37 -0300, Aspersieman <aspersieman@gmail.comescribió: Use socket.setdefaulttimeout(timeout_in_seconds) before you create the POP3 object; this value will be used by the...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.