Notes:
- I am using asp.net 4.5
- I am using a master page
- FriendlyURLs is installed by default
- I am trying to cross page post using the POST method
On the target url, it comes back with PreviousPage = null
Is this due to FriendlyURls?
source:
<asp:Button ID="btnSubmit" class="btn btn-primary" PostBackUrl="~/NewApplicationConfirmation.aspx" runat="server" Text="Submit" />
target:
protected void Page_Load(object sender, EventArgs e)
{
if (PreviousPage != null)
{
if (PreviousPage.IsCrossPagePostBack == true)
{
var cp = PreviousPage.Master.FindControl("MainContent") as ContentPlaceHolder;
TextBox PrevinputAppName = cp.FindControl("inputAppName") as TextBox;
inputAppName.Text = PrevinputAppName.Text;
}
else if (PreviousPage.IsCrossPagePostBack == false)
{
inputAppName.Text = "page.previouspage.iscrosspagepostback is false";
}
}
else inputAppName.Text = "page.previouspage is null";
}
EDIT: I eventually used this code to solve my problem:
.aspx
<asp:Button ID="btnSubmit" class="btn btn-primary" onclick="Transfer_Click" runat="server" Text="Submit" />
code-behind
protected void Transfer_Click(object sender, EventArgs e)
{
if (Page.IsValid)
{
Server.Transfer("~/NewApplicationConfirmation.aspx");
}
}