The mystery of passing form values

Discussion in 'ASP .Net Web Controls' started by Joseph Bergevin, Jan 10, 2006.

  1. 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?
    Joseph Bergevin, Jan 10, 2006
    1. Advertisements

    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.
    Phillip Williams, Jan 10, 2006
    1. Advertisements

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 (here). After that, you can post your question and our members will help you out.