View ASP .NET variable values in C#

  • Thread starter Thread starter Antoni Massó Mola
  • Start date Start date
A

Antoni Massó Mola

I have a form that sends data to another .aspx page.

In the second .aspx I have this code to retrieve the form's values and
create sessions:

Application("Login") = Request.Form("txtLogin") Application("Password")
= Request.Form("pwdPassword")

I need to validate this values with the C# code I use to connect to the DB2
database.

Is it possible to access the Request.Form("txtLogin") value from the C#
code?

Thanks
 
Not clear. Don't you alreay use Request.fomr to retrive this value. Also
once you stored these values in application variables they are available
from anywhere. NOTE that I would put this rather in session as application
variables are shared by all sessions and this could result in a problem if
multiple users are logging at the same time (you could also use a
"sessionid" so that you can connect later using an application specific
account).

Actually my personal preference is to post data to the same page so that a
single page handles the whole process...

Patrice
 
Not sure what you are asking. Just do something like "string myVariable =
Request.Form(...)".
 
Thanks for the comments.

I found what I was looking for:

strLogin = Request.Form["txtLogin"]
strPassword = Request.Form["pwdPassword"]

Patrice, I'll post data in the same page, better idea than using two
different pages.

What do you mean with putting it in sessions? Many users will connect to
this web page and I need to maintain their user name in a session variable,
which is the best way to acheive this?

Thanks
 
I meant that storing them in the Application object as shown in the
pseudo-code you posted fisrt, is not a good idea, as its values are shared
by all users (ie this is the same value for all users).
If you want to maintain a value that is unique to each user it is best to
keep it in the Session object (each user having its own set of session
variables).

It looks like each user will connect to the DB2 database using its own
login. Another option is to use a single account to connect all users and to
handle rights at the application level (using the same connection allows to
benefit from connection pooling).

Patrice
--

Antoni Massó Mola said:
Thanks for the comments.

I found what I was looking for:

strLogin = Request.Form["txtLogin"]
strPassword = Request.Form["pwdPassword"]

Patrice, I'll post data in the same page, better idea than using two
different pages.

What do you mean with putting it in sessions? Many users will connect to
this web page and I need to maintain their user name in a session variable,
which is the best way to acheive this?

Thanks


Peter Rilling said:
Not sure what you are asking. Just do something like "string myVariable =
Request.Form(...)".

the
DB2
 
Thanks!

Patrice Scribe said:
I meant that storing them in the Application object as shown in the
pseudo-code you posted fisrt, is not a good idea, as its values are shared
by all users (ie this is the same value for all users).
If you want to maintain a value that is unique to each user it is best to
keep it in the Session object (each user having its own set of session
variables).

It looks like each user will connect to the DB2 database using its own
login. Another option is to use a single account to connect all users and to
handle rights at the application level (using the same connection allows to
benefit from connection pooling).

Patrice
--

"Antoni Massó Mola" <[email protected]> a écrit dans le message de
Thanks for the comments.

I found what I was looking for:

strLogin = Request.Form["txtLogin"]
strPassword = Request.Form["pwdPassword"]

Patrice, I'll post data in the same page, better idea than using two
different pages.

What do you mean with putting it in sessions? Many users will connect to
this web page and I need to maintain their user name in a session variable,
which is the best way to acheive this?

Thanks


Peter Rilling said:
Not sure what you are asking. Just do something like "string
myVariable
 
Back
Top