zoukankan      html  css  js  c++  java
  • ASP.NET MVC 3 Refresh

    For those action type which derive from ActionResult

    Name Result
    ContentResult String literal
    EmptyResult None
    FileContentResult/
    FilePathResult/
    FileStreamResult
    Contents of a file
    HttpUnauthorizedResult HTTP 403
    JavaScriptResult Script to execute
    JsonResult JSON format
    RedirectResult Redirects to a new URL
    RedirectToRouteResult Redirect to another action
    ViewResult/
    PartialViewResult
    View

    Use ActionName attribute to give action an alias name.

    Use AcceptVerbs attribute to define action(“Httpverbs.Post” or "Httpverbs.HttpGet”)

    Action Filters

    Name Result
    Authorize Only allow authorized users or roles
    HandleError When unhandled exception occurred, specify a view
    OutputCache Cache the output
    ValidateInput Turn off request validation
    ValidateAntiForgeryToken Prevent cross site request

    If you need something to be executed when any action was triggered, create a new customize attribute and derive from ActionFilterAttribute.

    The ActionFilter could be put to Golbal.asax file to make it global, so this way could avoid to put it everywhere in the code.

    Switch from C# mode to HTML in Razor: Use TEXT tag or “@:”.

    Use ChildActionOnly attribute to stop user to invoke the action from URL and gain the benefit from PartialView at the same time.

    Happy Coding Everyday~ 快乐编码,享受生活~
  • 相关阅读:
    MongoDB +JSON+JQuery.Pagination+Linq 实现无刷新分页
    DBHelper
    C# .Net动态调用webService
    .net 将图片文件转换成流输出到浏览器
    将mongodb作为服务
    .net 最简单文件上传支持跨服务器
    Windows Phone 7
    javascript中对Date类型的常用操作
    DataTable 转换JSON
    C# 实现 MemCache 监控管理工具
  • 原文地址:https://www.cnblogs.com/tedzhang/p/3102113.html
Copyright © 2011-2022 走看看