Tuesday, December 14, 2004

Sometimes Post-Back Isn't an Option

When switching from ASP to ASP.NET years ago, it took me a long time to get adapted to posting-back a form. To this day, I still find reasons why using post-back is more of a pain than a help, such as adding a search text box to every page in a web site... a problem I'm having with my current project.

To solve this problem, I did a little research and found-out a nifty way to post form information from one ASP.NET page to another:
Server.Transfer("WebPostAway2.aspx", true)
Although using Server.Transfer isn't new to me, I never knew about the second parameter, preserveForm! Setting preserveForm to True keeps all the post data intact as it's passed to the next ASPX page.

No comments: