[英]Asp.Net Mvc redirection problem?
我的故事是:我在單獨的視圖中有幾種表單,這些表單發布了描述信息以進行編輯。 每個描述都屬於不同的地方。 因此,我還將在表單中發送refTypeId信息,以確定哪個描述屬於哪里。 到目前為止還好。 但我想返回到編輯描述視圖,該視圖是在編輯描述后從中發送表單的。 因此,我需要知道我剛剛在EditDescription操作中編輯過的表單的來源。 我的EditDescription操作方法如下代碼:
[Authorize]
[HttpPost]
public ActionResult EditDescription(string descriptionToEdit, int refTypeId)
{
var entity = _entities.Descriptions.Where(e => e.Id == refTypeId).Select(e => e).FirstOrDefault();
entity.Description = descriptionToEdit;
_entities.SaveChanges();
var Description = _entities.Descriptions.Where(e => e.Id == refTypeId).Select(e => e).FirstOrDefault();
ViewData["Description"] = Description.Description;
TempData["Message"]="Description has been saved";
return (?);// i need to know which view that form was sent from
}
發送另一個名為ReturnUrl的參數,並在成功后重定向到該參數。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.