View ASP .NET variable values in C#

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
 
P

Patrice Scribe

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
 
P

Peter Rilling

Not sure what you are asking. Just do something like "string myVariable =
Request.Form(...)".
 
A

Antoni Massó Mola

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
 
P

Patrice Scribe

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
 
A

Antoni Massó Mola

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top