---
title: "What is a cross page posting?"  
description: "What is a cross page posting?"  
author: "Shikhar Arora"  
published: 2019-12-07  
canonical: https://answers.mindstick.com/qa/92551/what-is-a-cross-page-posting  
category: "technology"  
tags: [".net programming"]  
reading_time: 2 minutes  

---

# What is a cross page posting?

What is a cross page posting

## Answers

### Answer by Shrikant Mishra

Into the ASP.NET by default, submits the form to the same page. The cross-page posting is submitting the form to a different page. It is usually required when you are creating a multi page form to collect information from the user on each page. If moving from the source to the target page, the values of controls in the source page can be accessed in the target page.

When we want to use the cross-page posting, then first we have to use the **PostBack** URL attribute to specify the page you want to post to.

Here these steps are given below : Like

**Step(1):** Create a new ASP.NET website called CrossPagePosting. Mostly by default, the website is created with a single webpage, Default.aspx. Firstly A Right click the project in the Solution Explorer > Add New Item >Web Form. And Keep the original name Default2.aspx and click ‘Add’. A website will now contain two pages, Default.aspx and Default2.aspx.

**Step (2):-** In the source page, Default.aspx, drag&drop a button on the form. And set a text of the button as ‘TargetButton’. And after Set the ‘PostBackUrl’ property of a Button to the URL of the target page, Default2.aspx.

```
<asp:Button ID="Button1" runat="server" PostBackUrl="~/Default2.aspx" Text="TargetButton" /></div>
```

**Step 3:-** On the target page Default2.aspx, drop a label on the page from the toolbox.

**Step 4:-** Into the Page_Load() of Default2.aspx, you can then access the ‘PreviousPage’ property to check if the page is being accessed as Cross Page postback.

```
protected void Page_Load(object sender, EventArgs e)
{
       if (Page.PreviousPage != null)
       {
         }
}
```

### Read More :- [Cross Page Posting](https://www.mindstick.com/forum/34719/cross-page-posting)


---

Original Source: https://answers.mindstick.com/qa/92551/what-is-a-cross-page-posting

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
