簡體   English   中英

如何添加其他參數到RedirectPermanent?

[英]how to add additional arguments to RedirectPermanent?

我想在我的return Action中添加一個viewbag消息,如下所示。...

return RedirectToAction("Index", new { Message = "Accepted Successfully" });

上面的工作正常,但是我試圖在選項卡式索引視圖上做同樣的事情,發現以下操作后,導航到所需選項卡的唯一方法是...

return RedirectPermanent("~/ReferralTarget/Index/#users");

基本上索引是視圖,而用戶是索引頁面上的選項卡式視圖... RedirectPermanaent是否可以采用第二種方法? 謝謝..

如果必須使用RedirectPermanent ,則沒有第二個參數,則可以使用String.Format來生成url。

return RedirectPermanent(
 String.Format("~/ReferralTarget/Index/#users?Message={0}", "Message here"));

但您可以使用RedirectToActionPermanent解決您的問題

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM