Menu

#4 Navigation through the Web browser Back and Forward buttons

open
nobody
None
5
2009-03-20
2009-03-20
No

For a scenario with multiple Tasks and navigation between them, the navigation through the Web browser back and forward buttons brakes current version of the MVC#. It is very easy to reproduce by using the provided TasksInteraction sample application.

It seems like a serious bug. A real show stopper for using multiple Tasks.

The navigation through the Web browser Back and Forward buttons brings in a different .aspx page which doesn't belong to the current Task loaded into a Session object on the server side.

void WebformsView_Init(object sender, EventArgs e)
{

// This line of code sets requestedViewInf variable to a null value
// because httpContext.Request.AppRelativeCurrentExecutionFilePath page
// belongs to a different Task, not to a current task, i.e. currTask.
WebformsViewInfo requestedViewInf = currTask.Navigator.ViewsManager.ViewInfos
As WebformsViewInfoCollection).GetByUrl(httpContext.Request.AppRelativeCurrentExecutionFilePath);

}

What is happening is that .GetByUrl() method legitimately cannot find the current page from the client side browser in the Task which is considered current on the server side. That seems to be the reason for breaking the MVC# framework navigation between multiple Tasks using browser Back and Forward buttons.

A possible solution could be to search for a page from the browser in the entire Tasks collection.
Something like the following:
if(requestedViewInf == null)
{
search for a page from the browser in the entire Tasks collection
if found make that task current
navigate to the View
}

Discussion


Log in to post a comment.