Home All Groups Group Topic Archive Search About

The mystery of passing form values

Author
10 Jan 2006 10:20 PM
Joseph Bergevin
I have a login form on page A which needs to post its values to page B on a
diferent server. Both pages are ASP.NET 2.0. How do I get the values back
from the Request object?
I assumed that if I had an asp:TextBox with an ID "username" in form A that
I would retrieve the value ala Request["username"], but this isn't the case.
The keys are all modified strings like "ctl00$ContentPlaceHolder1$username",
which I can't search for because I don't know in advance. Do I need to search
for the substring in each key name myself? What am I not grasping here?

Author
10 Jan 2006 11:48 PM
Phillip Williams
http://msdn2.microsoft.com/en-us/library/ms178139.aspx
Quote from the above link:
"If the source and target page are in different applications, you cannot
directly get the values of controls on the page, but you can read the posted
data from the Form dictionary. You cannot read view state from the source
page, because it is hashed. If you want to store values in the source page
and make them available in a target page in another application, you can
store the values as strings inside hidden fields on the source page and
access them through Request.Form on the target page."

You can either copy the content of those textboxes upon losing focus to
hidden input objects using JavaScript (as the quote above suggests) or you
can search for the substring in each key name as you guessed below.  I think
both would work.

Show quoteHide quote
"Joseph Bergevin" wrote:

> I have a login form on page A which needs to post its values to page B on a
> diferent server. Both pages are ASP.NET 2.0. How do I get the values back
> from the Request object?
> I assumed that if I had an asp:TextBox with an ID "username" in form A that
> I would retrieve the value ala Request["username"], but this isn't the case.
> The keys are all modified strings like "ctl00$ContentPlaceHolder1$username",
> which I can't search for because I don't know in advance. Do I need to search
> for the substring in each key name myself? What am I not grasping here?