Popular Posts
Enable SSL connection for Jsoup import org.jsoup.Connection; import org.jsoup.Jsoup; import javax.net.ssl.*; import java.io.IOException; import java.security.KeyManagement... Build an OpenVPN server on android device Preparation An android device, in this case, Sony xperia Z is used Root permission required Linux Deploy for deploy i... LogonUser Function : impersonate a windows user // This sample demonstrates the use of the WindowsIdentity class to impersonate a user. // IMPORTANT NOTES:  // This sample can be run only ...
Stats
Action results
  • ActionResult

    Encapsulates the result of an action method and is used to perform a framework-level operation on behalf of the action method.
    public ActionResult Index()
    {
        return Show();
    }
    
    public ActionResult Show()
    {
        return View();
    }
    
  • ContentResult

    Represents a user-defined content type that is the result of an action method.
    public ActionResult Index()
    {
        return Content("Represents a user-defined content type that is the result of an action method.", "text/plain", System.Text.Encoding.UTF8);
    }
  • EmptyResult

    Represents a result that does nothing, such as a controller action method that returns nothing.
    public ActionResult Index()
    {
        return new EmptyResult();
    }
  • FileContentResult

    Sends the contents of a binary file to the response.
    public ActionResult Index()
    {
        //return new FileContentResult(Buffer, "application/pdf");
        return File(Buffer, "application/pdf");
    }
  • FilePathResult

    Sends the contents of a file to the response.
    public ActionResult Index()
    {
        return File(Server.MapPath("~/doc/sample.pdf"), "application/pdf");
    }
  • FileStreamResult

    Sends binary content to the response by using a Stream instance.
    public ActionResult Index()
    {
        using (var ms = new System.IO.MemoryStream())
        {
            TempImage.Save(ms, System.Drawing.Imaging.ImageFormat.Png);
            //return new FileStreamResult(ms, "image/png") { FileDownloadName = "logo.png" };
            return File(ms, "image/png", "logo.png");
        }
    }
  • HttpNotFoundResult

    Defines an object that is used to indicate that the requested resource was not found.
    public ActionResult Index()
    {
        return HttpNotFound("Page not fould");
    }
  • HttpStatusCodeResult

    Provides a way to return an action result with a specific HTTP response status code and description.
    public ActionResult Index()
    {
        return new HttpStatusCodeResult(System.Net.HttpStatusCode.Unauthorized);
    }
  • HttpUnauthorizedResult

    Represents the result of an unauthorized HTTP request.
    public ActionResult Index()
    {
        return new HttpUnauthorizedResult("Please sign in");
    }
  • JavaScriptResult

    Sends JavaScript content to the response.
    public ActionResult Index()
    {
        return JavaScript("alert(new Date());");
    }
  • JsonResult

    Represents a class that is used to send JSON-formatted content to the response.
    public ActionResult Index()
    {
        return Json(new { Message = "Represents a class that is used to send JSON-formatted content to the response." });
    }
  • PartialViewResult

    Represents a base class that is used to send a partial view to the response.
    public ActionResult Index()
    {
        return PartialView();
    }
  • RedirectResult

    Controls the processing of application actions by redirecting to a specified URI.
    public ActionResult Index()
    {
        //return Redirect("/Product");  // 302
        return RedirectPermanent("/Product");  // 301
    }
    Redirect and RedirectPermanent
  • RedirectToRouteResult

    Represents a result that performs a redirection by using the specified route values dictionary.
    public ActionResult Index()
    {
        //return RedirectToAction("Show");
        //return RedirectToActionPermanent("Show");
        //return RedirectToRoute(new { action = "Show" });
        return RedirectToRoute(new { action = "Show" });
    }
  • ViewResult

    Represents a class that is used to render a view by using an IView instance that is returned by an IViewEngine object.
    public ActionResult Index()
    {
        return View();
    }