Click to See Complete Forum and Search --> : Seperate users and webforms


Dozo_1st
August 24th, 2004, 11:40 AM
I am new with programming webforms, so any help is very welcome! :D

First off, I have a webform form1.aspx. I use vb.net for the code-behind. Everything is programmed in this code-behind.
In the application I also created a Class1.vb. This class holds user-input collected from the controls of the webform (textboxes, dropdownlists, etc).
When the user leaves the form and returns to this form, on return, the collected information stored in the class is put back in the controls as the user left it. It is declared in the form as
Dim CLB As New Class1

Now the problem:

If another user (on another computer) also retrieves this form1.aspx, all the stored data is also put in that user's page.

What I want is that every seperate user that retrieves this webform gets a new clean form which creates and holds it's own CLB.

Also, when it redirects to other pages, which have a public shared Object and is filled by the redirecting page - are you still following this? :sick: :sick: - I don't want one user overwriting this shared object by the other! I want for every user to get a clean new page of the webform to which is redirected to each with it's own filled shared object form their own redirecting page.

How do I do this??? :confused:

I have tried to be as clear as possible! :ehh:
Thanks in advance for all your help!

Dozo

On Request:

In form2:

Public Shared GoBackToOriginalForm As String

In form1:

Application.Form2.GoBackToOriginalForm = "Form1.aspx"
Response.Redirect("Form2.aspx")

In Form2:

'Do your thing and when finished:
Response.Redirect(GoBackToOriginalForm)

In Form3:
Application.Form2.GoBackToOriginalForm = "Form3.aspx"
Response.Redirect("Form2.aspx")

If I have user1 using Form1 and simultaneously user2 using Form3, the last process will be executed and user1 and user2 will both get redirected to the same page - the last fill of GoBackToOriginalForm.

MRutledge
August 24th, 2004, 11:41 AM
Can you post some sample code so we can better assist you.

Dozo_1st
August 27th, 2004, 07:34 AM
I did, see my first post. I have edited it.

MRutledge
August 27th, 2004, 09:45 AM
Your not using static member variables anywhere in your class are you? If you are then you need to redo those and use the viewstate instead.

Dozo_1st
September 2nd, 2004, 08:09 AM
No, I don't use static members. But how do I go about that? When I declare static VS says: 'Static' is not valid on a member variable declaration. Second, I still want the declaration to exist when the page is reloaded by the same user with the value which is put in by this user.

Or should I declare everyhting "Shared"???

Dozo :confused:

MRutledge
September 2nd, 2004, 10:14 AM
use the view state. Like this:

...
int nMyNumber = (int)this.ViewState["somethingIStored"];
// Some other code here
...
//Set the view state
this.ViewState["somthingIStored"] = this.txtFormField.Text;

Dozo_1st
September 8th, 2004, 10:01 AM
with a response.redirect I don't think viewstate cuts it. When redirecting you get a new fresh page. However, the public shared objects are stored, but are stored for everybody who uses the page on which the public shared object is declared :sick:

So even public sharing isn't a good option to do this. CORRECT ME IF I AM WRONG!!!!

What is the good thing?

Secondly, how do I pass data (e.g. a self-defined vbClass) from one webform to another? Just as a reminder: I only use the code-behind!

Dozo

MRutledge
September 8th, 2004, 10:23 AM
Why use response.redirect? You have over complicated the problem.

Dozo_1st
September 9th, 2004, 07:07 AM
How should I decomplicate the problem? Can you also provide example-code?

Thanks!

Dozo

MRutledge
September 9th, 2004, 10:23 AM
One thing you could do is create a GUID for each thread that has started. Then using a database you can store the information the user entered and associate it with the guid. You can us a session variable tokeep track of this guid for the user. This way you dont have to worry about shared objects, or a form being populated with another users information. You can also make the user login. Once the user logs in you can reassociate the users information from the guid to the appropriate login id.

Dozo_1st
September 14th, 2004, 11:12 AM
I a trying to make a logon page... but I'm getting high blood pressure.
See: http://www.codeguru.com/forum/showthread.php?t=310084

Dozo