내 컨트롤러는 다음과 같습니다Action 메서드를 직접 호출하여 전송?
public ActionResult Action1(Action1Model model)
{
.....
if (...)
return Action2(new Action2Model() { .... }); //**
else
return View(model);
}
public ActionResult Action2(Action2Model model)
{ ... }
는 기본적으로 조치 1에서 특정 조건 하에서 내가 대신 조치 2로 처리를 전송할. 위의 코드는 오류 : The model item passed into the dictionary is of type 'Action2Model', but this dictionary requires a model item of type 'Action1Model'
을 제공합니다. 복잡한 모델을 가질 수 없습니다,
return RedirectToAction("Action2", new { parm1 = ..., parm2 = ... ...});
하지만이 방법은 쿼리 문자열에있는 모든 매개 변수를, 302 (추가 HTTP 호출)를 반환 노출 :
나는 그것이 ** 줄에서이를 사용하여 작업 할 수 있습니다 , 경로 값을 채울 때 유형 검사가 없습니다.
쿼리 문자열에 모델 세부 정보를 표시하지 않고 작업을 전송하는 좋은 방법이 있습니까?
감사합니다. 그것은 아름답게 작동합니다! –