WebSession use question

I am working on a router class that will hold a stack of navigated pages so you can push a page or pop from a page… The router class is responsible for showing the page. This router receives the instance of the new page and a session. Then it will set the session.currentpage property to the new page… There’s a lot of other logic going on that performs some other things, but for my question I simplified this.

The way I am doing this is having my router class being a property in the user WebSession. Then whenever I want to route a page, I also send the current session. Say I am on a button in a webpage PageA and want to route to a webpage PageB :

I will say in the buttons “ACTION” event:

Dim PageB as new WebPage
Session.router.pushpage(PageB, Session)

The router class in turn will grab the Session object and set the .currentpage property to the new page.

So my question is if this functionality will work? Will the session be always pointing to the right session or will I have to send a context to my router class instead of a session?

Make sure you are storing a WeakRef to the session, or you’ll have created a memory leak and the sessions will never get disposed of when users disconnect.

Thanks… However quick question. I am not storing the session anywhere, I am just using it when it get’s passed…

[code]Dim PageB as new WebPage
Session.router.pushpage(PageB, Session)

[/code]

In the RouterClass:

Session.CurrentPage = PageB

Should i declare the method in the class with a WeakRef ?

No that’s good.

Thank you…