views:

27

answers:

1

I have PageA with some controls (txtFooBar) on it, and a button with PostBackUrl set to PageB.

In PageB I can write

Page.PreviousPage.FindControl("txtFooBar")

and get at my values.

Now suppose I am using forms authentication, and PageB is protected, and I'm not initially logged in, so when I press the button on PageA I go to the login page, and proceed to PageB once I am logged in.

Now, Page.PreviousPage is null.

Is there any way I can get at the values from PageA? I am trying to avoid using the Session object to manage state here, as I need the application to be highly scalable and would prefer to avoid session affinity.

+2  A: 

It is caused by redirect from login page, while PreviousPage supported only over POST. So review following ways:

  • create inplace login control on the page A, so user could be logged in without redirect
  • create your own login form, that instead of redirect uses Server.Transfer to pageB (note that to auth user only FormsAuthentication.SetAuthCookie is needed)
Dewfy