Is there any way to get previous page url in silverlight navigation application. I am using navigation Service.
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
There is no way to get the navigation history, you can store it by yourself by listening the navigation service event NavigationService.Navigated (or Frame.Navigated for frame navigation).
private List<Uri> _navigationHistory = new List<Uri>();
void onNavigated(object sender, NavigationEventArgs e)
{
_navigationHistory.Add(e.Uri);
}
private Uri getBackUri()
{
return _navigationHistory.Count > 1
? _navigationHistory[_navigationHistory.Count - 2]
: null;
}
回答2:
There is a way through which you can get URL of previous page before postback.
if (!IsPostBack)
{
Session["PrvPageUrl"] = Request.UrlReferrer.ToString();
}
It might be help you.