我想添加新的obj JSON:
"128": {
"Msg": [{
"me": "hi"
}, {
"user": "hello"
}, {
"me": "whtup"
}]
}
Run Code Online (Sandbox Code Playgroud)
在存在的JSON对象示例中JSON:
{
"188": {
"Msg": [{
"me": "hi"
}, {
"user": "hello"
}, {
"me": "ki chal riha hai"
}]
},
"123": {
"Msg": [{
"me": "hi"
}, {
"user": "hello"
}, {
"me": "whtup"
}]
},
"128": {
"Msg": [{
"me": "hi"
}, {
"user": "hello"
}, {
"me": "whtup"
}]
}
Run Code Online (Sandbox Code Playgroud) [Authorize]
public class MyController : BaseController
{
[PermissionAuthorize]
public ActionResult GridData()
{
return Json(data, JsonRequestBehavior.AllowGet);
}
}
Run Code Online (Sandbox Code Playgroud)
我为特定操作的用户检查权限创建了PermissionAuthoize属性.我遇到问题用户会话或故障单在此时间到期后如果用户向Controller发送ajax requrest,则Authorize属性拒绝该请求并以html登录表单的形式返回给user.this region用户认为应用程序未执行.它显示了对用户的不良影响.
所以,如果他们在票证过期时发送ajax请求,我想重定向到用户登录页面.
我可以为控制器创建另一个授权属性吗?
我想以编程方式将输出缓存应用于特定控件.但是,当我使用此代码时,它将所有页面和其他用户控件存储在缓存输出中.
if (Session["id"] != null)
{
Response.Cache.SetExpires(DateTime.Now.AddSeconds(60));
Response.Cache.SetCacheability(HttpCacheability.Public);
Response.Cache.SetValidUntilExpires(true);
}
Run Code Online (Sandbox Code Playgroud)