Is there any way to get previous page url in silverlight navigation application

淺唱寂寞╮ 提交于 2019-12-02 07:27:02

问题


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.



来源:https://stackoverflow.com/questions/16392316/is-there-any-way-to-get-previous-page-url-in-silverlight-navigation-application

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!