Module in VB.net webproject

  • Thread starter Thread starter Cor
  • Start date Start date
C

Cor

Hi,
I was trying to make a nice example for Luís Serpa when something happened
that I found strange.
Who can tell me what I do wrong.

I made a normal Webform class with the IDE so automatic an Aspx page (but
that is not important for this question)
I made:
- A button and a textbox on the form;
- A module with a public string variable;
- The button was used to append a string in the textbox.

And then it happened: I was always thinking that I only could use "session"
information or a database or whatever. No the data did stay in the string
variable every time and when I did a push on the button the string became
longer and longer.

I stopped the debug session and started again. The magic was there, the old
value from the variable showed up.
I made an extra button, to stop the session with session.abandon, no
success.
I added session.clear, no success.
I waited 1 minute, and yes it was cleared. I tried this different times and
the string was cleaned, but for me at unpredictable times.
I made a test with a session.item that I loaded with the first button and
with that there was no problem, it was nice cleaned with the session.clean
every time I pushed the extra button.

Is this normal behaviour or am I doing something wrong.
(It looks if the dll stays alive and is picked up again with the next
visit).

(Visual Studio Net 2003 I did test it too with IE 6.0)

Thank you.
Cor
 
Hi Cor,

And I quote:

Are you sure this is a Visual Basic Studio Net Language question?

This is a VB.net languages group

.. for items about a webserver you can get more
information in the the asp.net group

news://msnews.microsoft.com/microsoft.public.dotnet.framework.aspnet

Regards,
Fergus

LMAO :-D
 
Hi Cor,

This is what I understand.

The normal behaviour (and one of the things that MS blows its aspx
trumpets about) is that runat=server controls persist their values.

So each time you press the button, the Module string is appended to the
TextBox text. and it is the TextBox text that is growing, not the Module
string.

When the session times out, the TextBox is reset, as you have found. The
unpredictability is simply that computers can't count :-).

I have no idea why your forced session abandon and clear failed to work.

Regards,
Fergus
 
Fergus,
Thanks but I think not, at every webpage load VB.Net normaly resets
everything.
It happens like this.
I start IE the textbox is empty
I push sometimes and the pages is every time reloaded with a value from the
mod say till 11111
I put in the label on the same time from a session.item("X) that I have
filled with "This is a VB.net language application"
I have a button to stop the session and to clear the session
I close by hand IE
Do not put of the power
I start IE
On the label is nothing
In the textbox = 11111
I think that is magic
Cor
 
Hi Cor,

|| I put in the label on the same time from a
|| session.item("X) that I have filled with
|| "This is a VB.net language application"

LOL.

I'd like to have a play. Could you post me a zip of the project (direct to
me if not to the newsgroup) ?

Regards,
Fergus

ps. I'm going out just now and won't reply for a while.
 
Hi Fergus,
I had arranged it all to send to you, but I want to do some investigation
myself first.
At the moment I think that the module is only cleaned by stopping the Web
server or a new build or rebuild of the program and not by the end of the
session.
I want to see too if it is totally public or only public for the user who
started it but that takes some time.
Maybe I need the asp.net group. Maybe they can tell me all about the
lifetime of a VB.net module in asp.net :-))))
There is something on msdn in a chat, but in my opinion that says that it
ends by the end of the program.
But it is not direct written in that ways, maybe you can look if I
misunderstand it.
You can too interpret it as when the program ends in memory.
It is a chat and I suppose you can better see those little things in words
than I.
Keywords for the search on msdn are "module" and "lifetime".
There are only two topics then you see it direct.
You have to search in the chattext again for "module"
Thanks I hope it was a pleasant evening for you.
Cor
 
Back
Top