ASPNET MVC3技术要点(19)
发布时间:2021-06-06
发布时间:2021-06-06
ASPNET MVC3技术要点
('personalization','1', 1) go
INSERT INTO [dbo].[aspnet_SchemaVersions] ([Feature]
,[CompatibleSchemaVersion] ,[IsCurrentVersion]) VALUES
('profile','1', 1) go
INSERT INTO [dbo].[aspnet_SchemaVersions] ([Feature]
,[CompatibleSchemaVersion] ,[IsCurrentVersion]) VALUES
('role manager','1', 1) go
3.3.1.2.1.3 执行该文件所有语句
3.3.1.2.2 在需要是否认证的控制器或动作函数前添加
[Authorize]
public class HomeController : Controller
{ }
........
3.3.2 动作/结果过滤
3.3.2.1 编写属性操作文件 (例ProfileAllAttribute.cs)
using System.Diagnostics; using System.Web.Mvc;
namespace ControllersAndActions.Infrastructure.Filters {
public class ProfileAllAttribute : ActionFilterAttribute {
private Stopwatch timer;
public override void OnActionExecuting(ActionExecutingContext filterContext) {
timer = Stopwatch.StartNew(); }
public override void OnActionExecuted(ActionExecutedContext filterContext) {
timer.Stop();
filterContext.HttpContext.Response.Write( string.Format("Action method elapsed time: {0}",
上一篇:S3C44B0 学习板使用指南
下一篇:朗文交互英语第二级A2答案