我想獲取上一頁的名稱,但問題是我的代碼無法獲取上一頁的名稱。例如,我有兩頁Previous.aspx
和Next.aspx
。在Next.aspx
頁面中,我需要頁面URL的頁面名稱Previous.aspx
。我怎樣才能做到這一點?我在Next.aspx
頁面嘗試了以下代碼。如何從重定向頁面獲取上一頁的名稱
public string GetPreviousPageName()
{
string Path = System.Web.HttpContext.Current.Request.UrlReferrer.AbsolutePath;
System.IO.FileInfo Info = new System.IO.FileInfo(Path);
string pageName = Info.Name;
return pageName;
}
你的意思是標題標籤?頁面標題。 –
@Tuğrul是的,我想要頁標題 – user1659510
我會使用Cookies。保存並加載。餅乾[ 「標題」] = Page.Title; –