views:

211

answers:

3

I have tried, 'PreviousPage', 'PreviousPage.IsCrossPagePostBack' 'Page.previousPage', page.title

It causes the client to stop rendering the page after this line.

simple example

protected void Page_Load(object sender, EventArgs e)
{
response.write("I can see this");
string test = PreviousPage.IsCrossPagePostBack.toString(); //Any page call Causes client rendering to freeze
response.write("But i cant see this");   
System.Windows.Forms.MessageBox.Show("However i can see this,proving that the server is still running the code");   
}

Anybody Please, any ideas?

A: 

Have you checked PreviousPage for null?

From msdn:

The PreviousPage property is a null reference (Nothing in Visual Basic) when the user requests that page directly from the server.

Also - MessageBox in a web form, not a great idea... perhaps use the inbuilt trace.axd

Marc Gravell
A: 

I know about the dangers of mboxs and web forms, i was just proving a point, thank you for the tip though.

Yes i have checked and its reporting back the correct previous page.

All im getting is this:

Thread was being aborted.
  at System.Web.HttpServerUtility.ExecuteInternal(IHttpHandler handler, TextWriter     writer, Boolean preserveForm, Boolean setPreviousPage, VirtualPath path, VirtualPath     filePath, String physPath, Exception error, String queryStringOverride)
  at System.Web.HttpServerUtility.Execute(IHttpHandler handler, TextWriter writer, Boolean preserveForm, Boolean setPreviousPage)
  at System.Web.UI.Page.get_PreviousPage()
  at indirect.get_PreviousPage() in c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\development2\94c709e7\c4f4b746\App_Web_-qi_dkqs.0.cs:line 0
  at indirect.Page_Load(Object sender, EventArgs e) in d:\Projects\PROJECTNAME\code\ASP\DEVELOPMENT\PAGENAME.aspx.cs:line 31

line 31 is this:

Response.Write(PreviousPage.IsCrossPagePostBack.ToString());
+1  A: 

ANSWER

Well it ended up it was something stupid. code smell over.

The button i was using to fire the PostBack had a handler that fired to redirect, i just deleted the handler, keeping the PostBackUrl setting and magic.