I have a button in my aspx page, which in code behind the value of postbackurl gets set. I updated the code to add click event handler and added Response.Redirect code to redirect user to the page once the button is clicked. The only reason i ended up adding click event was because i had to add some extra logic when the button was clicked including redirecting to same url, that was used in postbackurl. The page does get redirected on click however it seems like all the hidden fields from the field gets lost once the form get redirected to the url. Is there anyway i can submit the form without loosing the hidden data.?
Asked
Active
Viewed 2,160 times
0
-
What version of asp.net are you using? – Hogan Jul 11 '12 at 02:07
-
I think a code sample would help. +1 for the Server.Transfer suggestion. – Glenn Ferrie Jul 11 '12 at 02:29
-
I think that only works if the page in same server. I am redirecting user to different site in different server. – sanjeev40084 Jul 11 '12 at 02:44
-
A different server?! LOL. OK then, pass parameters for those calls and just return for no-op. – Hogan Jul 11 '12 at 02:56
1 Answers
1
Maybe one way you can solve this problem is to use the server side Transfer() call.
http://msdn.microsoft.com/en-us/library/540y83hx(v=vs.85).aspx
In most cases I've seen what you really want to do is pass the information for the new page using URL parameters. Take all the stuff the new page needs and put it into the url (encrypt if it is security sensitive).
If the only issue you are having is when you want to stay on the same page, this is simple, just have the click event handler return without doing a response.redirect or a transfer.
Post the code if this is not working for you.

Hogan
- 69,564
- 10
- 76
- 117