29 Mart 2016 Salı

.Net Mvc ActionResult Tipleri

Yorum Bırak
ActionResult bir abstract classtır ve birkaç alt tipi bulunmaktadır. Bu alt tipleri controller tarafından kendi ihtiyacımıza göre döndürebiliriz. Bunlar aşağıdaki gibidir:



  • ViewResult - Metoda ait view'i render eder
  • PartialViewResult - metoda ait partial view'i render eder
  • EmptyResult - boş bir response döndürür
  • RedirectResult - belirtilen urlye http redirection yapar
  • RedirectToRouteResult - verilen route data temelinde route engine tarafından belirlenen bir url'ye http redirection yapar
  • JsonResult - Verilen ViewData objesini JSON formatına serialize eder
  • JavaScriptResult -Client tarafında çalıştırılabilecek bir javascript kodu döndürür
  • ContentResult - Content'i response stream'e yazdırır (View gerekmeden)
  • FileContentResult - Client'a dosya döndürür
  • FileStreamResult - Stream tarafından sağlanan bir dosyayı clienta döndürür
  • FilePathResult - client'a dosya path döndürür

0 yorum:

Yorum Gönder