我有一些代碼如下;在C#中的RedirectToAction是否昂貴?
我們將創建一個Note,但是當我們這樣做時我們可能知道CustomerId我有兩個URL;
public ActionResult CreateByCustomer(int id)
{
Session["ncAppointmentId"] = 0;
Session["ncNoteDate"] = null;
SetConsultant(0);
return RedirectToAction("Create", "Note", new { id = id });
}
public ActionResult Create(int id = 0)
{
int _CustomerId = id == 0 ? Convert.ToInt32(Session["CustomerId"]) : id;
Session["TemplateIds"] = null;
and so on.......
ViewBag.CustomerId = _CustomerId;
當我看着螢火蟲的表現RedirectToAction導致了「302找到」狀態,可招致長達1秒鐘的延遲一個GET。
如果我更改了RedirectToAction線
return Create(0);
然後GET不會發生,並提高性能。
但我在尋找意見是什麼缺點或我錯過了什麼?
感謝你,我的想法了寶貴的確認。 回覆:jQueryUI - 可以用於簡單的編輯,但使用IFrame可以提供更好的進程隔離和可重用性 –