Cross Page Posting & Validation


Server side validation will be ignored in case you are using the Cross Page Posting feature in ASP.NET 2.0 and therefore you can't know what was the user input. However on the redirected page, you can still check the previous page IsValid method. In such  scenario, if the IsValid property of the previous page is false, you can redirect the user back to the previous page but all the input fields will be losing their data because like you might know the ViewState is not maintained.

Below is code implementation:

protected void Page_Load(object sender, EventArgs e)
{
 if(!PreviousPage.IsValid)
    {
  Server.Transfer("Default.aspx");
    }
 else
    {
  // Execute the code
    }
}

HC

Published 22 January 2008 11:58 AM by haissam

Comments

# Pages tagged "web 2.0" said on 22 January, 2008 06:46 AM

Pingback from  Pages tagged "web 2.0"

This site

Search

Go

This Blog

Syndication

Sponsors

  • MaximumASP
  • Packet Sniffer