Different types of results in MVC

In MVC there are almost 12 types of result , Actionresult class is the base class and there are eleven sub types are available.

a)Viewresult: for returning view only.

b)PartialViewResult: It will render a particular partial view result, the best example of it will be like ajax in mvc, in action link, if any one wants to return ajax based partialview result , it will best use to use this.

c)EmptyResult: for returning empty result as response.

d)Redirectresult: performs http redirection

e)RedirectTorouteresult: Performs an HTTP redirection to a URL that is determined by the routing engine, based on given route data

f)jsonresult: it is very useful for returning any  list as jsonresult format.

g)javascriptresult: will return javascript code for executing to client.

h)Contentresult: Writes content to the response stream without requiring a view

i)Filecontentresult: is the best useful for downloading a file script.

j)FileStreamresult: return file as binary bstream

k)Filepathresult: Returns a file to the client

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes:

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>