Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is cross-page posting in ASP.NET?

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?
like image 580
ACP Avatar asked Mar 03 '10 03:03

ACP


2 Answers

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.

like image 141
Andrew Hare Avatar answered Oct 14 '22 04:10

Andrew Hare


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.

like image 1
No Refunds No Returns Avatar answered Oct 14 '22 03:10

No Refunds No Returns