Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Re: How to open a new window then close it but retain session?

Reply
Thread Tools

Re: How to open a new window then close it but retain session?

 
 
Alexey Smirnov
Guest
Posts: n/a
 
      05-21-2010
On May 21, 6:49*pm, MWulfe <(E-Mail Removed)> wrote:
> I want to open a new browser window from my main page from a button
> click event while retaining all the session variables, but I have a
> few other requirements:
>
> 1. *Before the main window closes, I want to check that spefic text
> boxes and dropdowns have been filled in. *If not, i want to display an
> alert, which I am doing with a js script and keep the main page
> displayed.
>
> 2. *Before the main window closes I want to set a bunch of session
> variables based on what was entered in the main window, for use in the
> new window.
>
> 3. *When closing the new window, I would like there to be no
> confirmation window displayed, and i want to keep the session
> variables' values.
>
> Any ideas?


Why do you need to close window, when user still remain on the site?
If window was not opened via javascript, you cannot close it without
client prompt, if I'm not wrong. It means that this will not probably
work as you expected and it will be much easy not to close any window
automatically.
 
Reply With Quote
 
 
 
 
Alexey Smirnov
Guest
Posts: n/a
 
      05-21-2010
On May 21, 9:43*pm, MWulfe <(E-Mail Removed)> wrote:
> On Fri, 21 May 2010 11:36:01 -0700 (PDT), Alexey Smirnov
>
>
>
>
>
> <(E-Mail Removed)> wrote:
> >On May 21, 6:49*pm, MWulfe <(E-Mail Removed)> wrote:
> >> I want to open a new browser window from my main page from a button
> >> click event while retaining all the session variables, but I have a
> >> few other requirements:

>
> >> 1. *Before the main window closes, I want to check that spefic text
> >> boxes and dropdowns have been filled in. *If not, i want to display an
> >> alert, which I am doing with a js script and keep the main page
> >> displayed.

>
> >> 2. *Before the main window closes I want to set a bunch of session
> >> variables based on what was entered in the main window, for use in the
> >> new window.

>
> >> 3. *When closing the new window, I would like there to be no
> >> confirmation window displayed, and i want to keep the session
> >> variables' values.

>
> >> Any ideas?

>
> >Why do you need to close window, when user still remain on the site?

>
> Because the main window is still open, and the user is still it. *It's
> only the new window that needs to close.
>
> >If window was not opened via javascript, you cannot close it without
> >client prompt, if I'm not wrong. It means that this will not probably
> >work as you expected and it will be much easy not to close any window
> >automatically.

>
> If I'm not wrong, the problem with opening a new window with js is
> that the new window will not have access to the session variables from
> the parent.


If you are using a cookie-based session and you just open a new
window, you'll share cookies, including the SessionID cookie and thus
the same session. If you launch this new window in a separate process,
then you will have a new session even for the same application.

http://msdn.microsoft.com/en-us/magazine/cc163708.aspx

Just try to output your session variables on the page to check how it
would work.
 
Reply With Quote
 
 
 
 
Alexey Smirnov
Guest
Posts: n/a
 
      05-22-2010
On May 22, 5:06*pm, MWulfe <(E-Mail Removed)> wrote:
> This does nor really answer my main questions. *
>
> I want to open a new window but only after executing code that (1)
> checks current values in text boxes and dropdowns, preventing the new
> window from opeing if certain conditions are unmet, *and (2) sets
> severl session variables that are retained in the new window.
>
> It looks like I will not be able to do this with JS. *According to MS,
> inhttp://msdn.microsoft.com/en-us/library/ms644696(VS.85).aspx,
> "Opening a new window using JavaScript is not supported in Windows 7
> and later. Instead, use a hyperlink with a target attribute equal to
> _blank."
>
> On Fri, 21 May 2010 14:55:18 -0700 (PDT), Alexey Smirnov
>
>
>
> <(E-Mail Removed)> wrote:
> >On May 21, 9:43*pm, MWulfe <(E-Mail Removed)> wrote:
> >> On Fri, 21 May 2010 11:36:01 -0700 (PDT), Alexey Smirnov

>
> >> <(E-Mail Removed)> wrote:
> >> >On May 21, 6:49*pm, MWulfe <(E-Mail Removed)> wrote:
> >> >> I want to open a new browser window from my main page from a button
> >> >> click event while retaining all the session variables, but I have a
> >> >> few other requirements:

>
> >> >> 1. *Before the main window closes, I want to check that spefic text
> >> >> boxes and dropdowns have been filled in. *If not, i want to display an
> >> >> alert, which I am doing with a js script and keep the main page
> >> >> displayed.

>
> >> >> 2. *Before the main window closes I want to set a bunch of session
> >> >> variables based on what was entered in the main window, for use in the
> >> >> new window.

>
> >> >> 3. *When closing the new window, I would like there to be no
> >> >> confirmation window displayed, and i want to keep the session
> >> >> variables' values.

>
> >> >> Any ideas?

>
> >> >Why do you need to close window, when user still remain on the site?

>
> >> Because the main window is still open, and the user is still it. *It's
> >> only the new window that needs to close.

>
> >> >If window was not opened via javascript, you cannot close it without
> >> >client prompt, if I'm not wrong. It means that this will not probably
> >> >work as you expected and it will be much easy not to close any window
> >> >automatically.

>
> >> If I'm not wrong, the problem with opening a new window with js is
> >> that the new window will not have access to the session variables from
> >> the parent.

>
> >If you are using a cookie-based session and you just open a new
> >window, you'll share cookies, including the SessionID cookie and thus
> >the same session. If you launch this new window in a separate process,
> >then you will have a new session even for the same application.

>
> >http://msdn.microsoft.com/en-us/magazine/cc163708.aspx

>
> >Just try to output your session variables on the page to check how it
> >would work.


Nonsense... it's about Microsoft HTML Help 1.4 SDK

You will be able to open a new window using javascript in Windows 7.
Just do a test

<script language="JScript">
function myOpen() {
open('http://msn.com');}
</script>
<body onload="myOpen();">
Test
</body>

Of course, all browsers that have popup blockers, will block the new
window from opening because of it's pop-up blocking feature.
 
Reply With Quote
 
Alexey Smirnov
Guest
Posts: n/a
 
      05-26-2010
On May 22, 8:31*pm, MWulfe <(E-Mail Removed)> wrote:
> On Sat, 22 May 2010 08:52:24 -0700 (PDT), Alexey Smirnov
>
>
>
>
>
> <(E-Mail Removed)> wrote:
> >On May 22, 5:06*pm, MWulfe <(E-Mail Removed)> wrote:
> >> This does nor really answer my main questions. *

>
> >> I want to open a new window but only after executing code that (1)
> >> checks current values in text boxes and dropdowns, preventing the new
> >> window from opeing if certain conditions are unmet, *and (2) sets
> >> severl session variables that are retained in the new window.

>
> >> It looks like I will not be able to do this with JS. *According to MS,
> >> inhttp://msdn.microsoft.com/en-us/library/ms644696(VS.85).aspx,
> >> "Opening a new window using JavaScript is not supported in Windows 7
> >> and later. Instead, use a hyperlink with a target attribute equal to
> >> _blank."

>
> >> On Fri, 21 May 2010 14:55:18 -0700 (PDT), Alexey Smirnov

>
> >> <(E-Mail Removed)> wrote:
> >> >On May 21, 9:43*pm, MWulfe <(E-Mail Removed)> wrote:
> >> >> On Fri, 21 May 2010 11:36:01 -0700 (PDT), Alexey Smirnov

>
> >> >> <(E-Mail Removed)> wrote:
> >> >> >On May 21, 6:49*pm, MWulfe <(E-Mail Removed)> wrote:
> >> >> >> I want to open a new browser window from my main page from a button
> >> >> >> click event while retaining all the session variables, but I have a
> >> >> >> few other requirements:

>
> >> >> >> 1. *Before the main window closes, I want to check that spefic text
> >> >> >> boxes and dropdowns have been filled in. *If not, i want to display an
> >> >> >> alert, which I am doing with a js script and keep the main page
> >> >> >> displayed.

>
> >> >> >> 2. *Before the main window closes I want to set a bunch of session
> >> >> >> variables based on what was entered in the main window, for use in the
> >> >> >> new window.

>
> >> >> >> 3. *When closing the new window, I would like there to be no
> >> >> >> confirmation window displayed, and i want to keep the session
> >> >> >> variables' values.

>
> >> >> >> Any ideas?

>
> >> >> >Why do you need to close window, when user still remain on the site?

>
> >> >> Because the main window is still open, and the user is still it. *It's
> >> >> only the new window that needs to close.

>
> >> >> >If window was not opened via javascript, you cannot close it without
> >> >> >client prompt, if I'm not wrong. It means that this will not probably
> >> >> >work as you expected and it will be much easy not to close any window
> >> >> >automatically.

>
> >> >> If I'm not wrong, the problem with opening a new window with js is
> >> >> that the new window will not have access to the session variables from
> >> >> the parent.

>
> >> >If you are using a cookie-based session and you just open a new
> >> >window, you'll share cookies, including the SessionID cookie and thus
> >> >the same session. If you launch this new window in a separate process,
> >> >then you will have a new session even for the same application.

>
> >> >http://msdn.microsoft.com/en-us/magazine/cc163708.aspx

>
> >> >Just try to output your session variables on the page to check how it
> >> >would work.

>
> >Nonsense... it's about Microsoft HTML Help 1.4 SDK

>
> >You will be able to open a new window using javascript in Windows 7.
> >Just do a test

>
> ><script language="JScript">
> >function myOpen() {
> > * *open('http://msn.com');}
> ></script>
> ><body onload="myOpen();">
> >Test
> ></body>

>
> >Of course, all browsers that have popup blockers, will block the new
> >window from opening because of it's pop-up blocking feature.

>
> Nonsense it is, you got it right. *Thanks!!


Glad if it helps.

Thought you might be interesting in Popup/ModalPopup Ajax Controls
from the ASP.NET AJAX Control Toolkit
http://www.asp.net/ajax/ajaxcontrolt...odalPopup.aspx
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: How include a large array? Edward A. Falk C Programming 1 04-04-2013 08:07 PM
open a new window, then close the old one Navillus Javascript 7 05-23-2006 12:33 AM
how to open and then close a new window? john ASP General 2 01-30-2006 06:36 PM
Help. SessionID is x then y then x then y BodiKlamph@gmail.com ASP General 0 09-03-2005 03:02 PM
close current window using window.close() Shang Wenbin Javascript 10 09-02-2005 12:16 AM



Advertisments