.NET Questions (CLOSED)

Questions and Answers on any aspect of .NET. Now closed.

This discussion group is now closed.

Have a question about .NET development? Try stackoverflow.com, a worldwide community of great developers asking and answering questions 24 hours a day.

The archives of .NET Questions contain years of Q&A. Even older .NET Questions are still online, too.

Avoid ASP.NET postbacks


I have a few web applications built using asp.net. I would like to transform and making them completly stateless.

My question is what's the best way to avoid using postback and submitting all the page controls by "get" (putting method=get in the form tag is not the best solution bacause it submits all the hidden control, ajaxtoolkits, etc...)? There is some additional framework to use?

I would like to accomplish this task the way fogbugz does and I know Jeol's team use asp.net...

Should I use the new MCV framework?

Thank guys for your help!
DV Send private email
Monday, August 11, 2008
Using AJAX controls is a great way to do this. Also doing most of your functions in JavaScript when you can. Make sure all the data you need is client side on page load if you can.
Sara C Send private email
Monday, August 11, 2008
AJAX uses both postback and viewstate, in most cases.

If you want a stateless ASP>NET project. set the EnableViewstate in the page directive and forms/controls to false (or in web.config). To disable sessions, you can set the enableviewstate to false as well of use the web.config settings. That will take out most viewstate and session calls. To use and capture data, just set your form action states to gets and you can capture querystring values. Also remember, even though you turn off Microsoft's clunky postbacks, when pressing a button, that button will post/get to the server naturally and you can iterate through the Request.Form collection and grab what button was clicked (sends an x/y coordinate value for image buttons) and also capture all input or form control tag values posted. All ASP.NET does is layer over all that a huge mess of objects which listen for these posted input controls sent in the headers and respond to them using hidden input viewstate values. So, you can go back to this more old-fashioned stateless systems easily.

I like the MVC/MPC stuff as well. REST is another option in .NET 3.5. But old ASP.NET will work any way you need. You just need to turn off all the extras.
Monday, August 11, 2008
The MVC framework sucks.

If you want to turn off all the automatic ASP.NET stuff, just remove the runat="server" attribute from the Form element.
Grumpy .NET programmer
Tuesday, August 12, 2008
Thanks, will try.
DV Send private email
Wednesday, August 13, 2008

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics
Powered by FogBugz