views:

145

answers:

2

I have a few questions about cross-page posting in ASP.NET:

  • What is cross-page posting in ASP.NET?
  • When should I consider using it in my web application?
  • What are pros and cons of cross-page posting?
+2  A: 

Basically, cross-page posting means that you are posting form data to another page as opposed to posting form data back to the same page (as is the default in ASP.NET). This can be useful when you want to post data to another page and don't want to incur the overhead of reloading the current page simply to redirect the user to another page via an HTTP 302 (i.e. Response.Redirect).

For a more information please see Cross-Page Posting in ASP.NET Web Pages:

By default, buttons and other controls that cause a postback on an ASP.NET Web page submit the page back to itself. This is part of the round-trip cycle that ASP.NET Web pages go through as part of their normal processing. For details, see Introduction to ASP.NET Web Pages.

Under some circumstances, you might want to post one page to another page. For example, you might be creating a multi-page form that collects different information on each page. In that case, you can configure certain controls (those that implement the IButtonControl interface, such as the Button control) on the page to post to a different target page. This is referred to as cross-page posting. Cross-page posting provides some advantages over using the Transfer method to redirect to another page. For details, see Redirecting Users to Another Page.

Andrew Hare
True. +1 to Andrew. Cross-page posting was the order of the day in classic ASP. Initially (.NET 1.1), this was missing.
Kangkan
+1  A: 

Cross - page posting is targeting a different page from the original page. ASP.NET is based on the post-back model where the same page that sent it to you processes the response.

COnsider using it when you have lots of entry points that need the same processing.

Pros: single point of handling common routine Cons: pages are hard-linked and have intimate knowledge. AKA coupling.

No Refunds No Returns