The mystery of passing form values

J

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?
 
P

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.
 

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

Members online

Forum statistics

Threads
473,766
Messages
2,569,569
Members
45,042
Latest member
icassiem

Latest Threads

Top