Keep Session Alive!!

When a new window is being opened from a modal or modaless form, it may loses the session. The cause according to Microsoft "This behavior occurs because Internet Explorer windows that are opened from a from a modal or modeless HTML dialog box may not be opened in the same process.".

Walkaround:

Send the parent window of the dialog box into the dialog box then use this object open the new window.

example below

Page1.aspx (Suppose it's the parent widow from which you want to open the dialogbox)

<script language=javascript>

function Open()

{

window.ShowModalDialog('WebForm2.aspx', window)

}

</script>

now in WebForm2.aspx, if you want to open another window you use

dialogArguments.window.open('WebForm3.aspx');

in this way, the WebForm3.aspx will still have the values of the session.

Best Regards,

 

 

Published 09 February 2007 03:56 AM by haissam

Comments

# Jorge Cañón said on 19 August, 2009 05:41 PM

Hello

I did a simple web service that start, show the state and remove a session.

When I open it directly (locahost/ws/manageSession.asmx) it works lovely.

Then, i did an individual page (localhost/consumeWsSession.aspx) to consume the web service obviously. It first start the session and recive -OK-, immediately I call other web method of the same web service to show the state and nothing :(

This is the code (inside consumeWsSession.aspx):

<script runat="server">    

Public Sub SOAP12_Click(sender As [Object], E As EventArgs)

   Dim service0 As New manageSession.manageSession()

   service0.Url = "localhost/.../manageSession.asmx"

   service0.SoapVersion = System.Web.Services.Protocols.SoapProtocolVersion.Soap12

   Try

       output.Text = service0.setSession("admin", "pswd")

   Catch exception As Exception

       output.Text = "Error: " + exception.Message

   End Try

   ' Until here (excellent) 8D

   ' Until here (excellent) 8D

   Try

       output.Text = service0.getSession()

   Catch exception As Exception

       output.Text = "Se produjo un error: " + exception.Message

   End Try

 ' In this point, it show that not exist session, while

 ' in the direct webservice indicates that yes.

 ' o_0

End Sub 'SOAP12_Click

Regars

Jorge Andrés Cañón Sierra

jacanon7@gmail.com

This site

Search

Go

This Blog

Syndication

Sponsors

  • MaximumASP
  • Breaking News
  • Find a Job
  • Social Bookmarking
    Tidebuy Reviews
    Online Shopping
    asp.net hosting
    UK online local dating