Forum  Commercial Foru...  Commercial Foru...  New User Verification
Previous Previous
 
Next Next
New Post 4/11/2010 1:37 PM
  palli
11824 posts
1st Level Poster




Re: New User Verification 

Hi Derek,

First you should realize that Context and Session is not the same thing. The session stores all the contexts active for each session, and if you have that second "window" (context) opening (created) on a different session, you will need another approach, if at all possible.

So, what you are talking about here is a different context within the same session, assuming the new context is created within the new session in the first place.

A Form with a TextBox showing the number of instances created, which equals the number of contexts created, and storing references to the other form and it's context in a session variable can give you some ideas on what can be done to make sure the former context is destroyed, but it will not close the browser tab for you, just make sure the context is destroyed.

The code below is just a skeleton, and you will need more error checking to make it feasible to use, but this is what I would try to start with:

 

Imports Gizmox.WebGUI.Forms
Public Class SessionTest
 
    Public Shared counter As Integer = 0
 
    Private Sub SessionTest_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        counter += 1
        TextBox1.Text = counter.ToString()
        If Context.Session("TestForm") IsNot Nothing Then
            Dim f As SessionTest = CType(Context.Session("TestForm"), SessionTest)
            Dim c As Gizmox.WebGUI.Common.Interfaces.IContext = CType(Context.Session("Testcontext"), Gizmox.WebGUI.Common.Interfaces.IContext)
            If c IsNot Me.Context Then
                c.Terminate(False)
            End If
        End If
        Context.Session("TestForm") = Me
        Context.Session("Testcontext") = Me.Context
    End Sub
End Class

Regarding the serialization of the form's data, you can find information on that in the Serialization article on the wiki here. In that article there is a reference to a codesample that you should study.

Hope this helps,

Palli

 


Páll Björnsson - Visual WebGui support team - Email: support@visualwebgui.com
 
New Post 4/13/2010 8:10 PM
  derekmhart@yahoo.com
717 posts
1st Level Poster


Re: New User Verification 
Modified By derekmhart@yahoo.com  on 4/14/2010 12:34:06 AM)

I see that if I send in Main.wgx by itself, and then send in Post.Main.wgx?Myvar=Somevalue, I the Load event fires. I also see that Session.IsLoggedOn still stays set to true, but my variables do not stay set, such as this variable:

VWGContext.Current("UserID")

I would need UserID to stay valid, and the Load event would properly allow me to direct the user into a specific place in the site (the whole point of sending in the parameter).

This leads me to believe that perhaps I am not using the right scope of the variables. Should I simply store the UserID in a session variable, and the other handful of variables into a session variable. Please explain the difference between VWGContext and a Session variable, and if you think I am on the right track.

I have gone into all my variables that are stored as VWGContext.Current("MyVar") and changed them all to VWGContext.Current.Session("MyVar") - there are only about 5 variables that need to be set at the session level for the Main Load event to properly function. It is okay for all other variables to go out of scope, as the Load event reinitializes everything.

I just want a link emailed to a user to take the user to a specific place in the site. I am okay if a previous window the user is in gets changed to that new location. I don't need completely independent windows with the same exact logged on user.

Is there any problem you can see with this strategy?

 
New Post 4/14/2010 1:38 PM
  palli
11824 posts
1st Level Poster




Re: New User Verification 

Hi Derek,

As I understand your strategy, this is more or less what I suggested in my last reply, so this would take care of the "serialization" needed for the relevant properties on your form, that must survive until for the new request.

At some point in this thread your concerns were that the new link posted would be a different user's registration or signup request, but if that is not a concern in this case, this should take care of your problem.

Palli

 


Páll Björnsson - Visual WebGui support team - Email: support@visualwebgui.com
 
Previous Previous
 
Next Next
  Forum  Commercial Foru...  Commercial Foru...  New User Verification
CompanionKit Bottom
.NET Web, Cloud and Mobile application delivery platform | Sitemap | Terms of Use | Privacy Statement | Copyright © 2005-2011 Visual WebGui®       Visual WebGui weblog on ASP.NET Visual WebGui Group on LinkedIn Visual WebGui updates on Twitter Visual WebGui Page on Facebook Visual WebGui YouTube Channel Visual WebGui Platform News RSS