ASP.NET MVC 4 Attribute特性

Attributes特性

 

[AcceptVerbs(…)]

To specify HTTP verbs an action method will respond to.

要指定HTTP动词的将响应的一个操作方法。

[ActionName(…)]

To define the name of an action

定义一个动作的名称

[AdditionalMetadata(…)]

to populate the ModelMetadata.AdditionalValues dictionary for a model property.

填充一个模型属性的ModelMetadata.AdditionalValues​​字典。

[AllowHtml]

To allow HTML markup during model binding by skipping request validation for the property.

允许HTML标记在模型绑定通过跳过属性的请求验证。

[AsyncTimeout(…)]

To set the timeout value, in milliseconds, for an asynchronous method.

要设置超时值,以毫秒为单位的异步方法。

[Authorize(…)]

To restrict access by callers to an action method.

调用者的操作方法来限制访问。

[ChildActionOnly]

To indicate that an action method should be called only as a child action.

要表明,作为一个的操作方法只应被子动作调用。

[HandleError(...)]

to handle an exception that is thrown by an action method.

处理异常就是将一个操作方法抛出。

[HiddenInput(…)]

To render a property or field value as a hidden input element.

为了呈现一个隐藏的输入元素属性或字段的值。

[HttpDelete]

to restrict an action method to handle only HTTP DELETE requests.

限制一个动作方法只处理HTTP DELETE请求。

[HttpGet]

to restrict an action method to handle only HTTP Get requests.

限制一个动作方法只处理HTTP GET请求。

[HttpPost]

to restrict an action method to handle only HTTP Post requests.

限制一个动作方法只处理HTTP POST请求。

[HttpPut]

to restrict an action method to handle only HTTP Put requests.

限制一个动作方法只处理HTTP PUT请求。

[ModelBinder(..)]

to associate a model type to a model-builder type.

关联模型类型的模型生成器类型。

[NoAsyncTimeout]

To set the timeout to infinite (never).

要设置超时无限(从不)。

[NonAction]

To indicate that a controller method is not an action method.

为了表明控制器方法不是一个操作方法。

[OutputCache(..)]

To mark an action method whose output will be cached.

为了标记其产出将是缓存的一个操作方法。

[Remote(…)]

It is used to invoke the server-based validation from client side.

它是用于从客户端调用基于服务器的验证。

[RequireHttps]

It forces an unsecured HTTP request to be re-sent over HTTPS.

它迫使重新通过HTTPS发送不安全的HTTP请求。

[SessionState(…)]

Specifies the session state of the controller.

指定控制器的会话状态。

[ValidateInput(...)]

To mark action methods whose input must be validated.

为了标记一个动作方法的输入必须进行验证。

转载于:https://www.cnblogs.com/yangzhenping/p/3345537.html

你可能感兴趣的:(测试)