【发布时间】:2013-09-20 06:52:13
【问题描述】:
asp.net mvc3 中的 302 found 错误代码是什么?我正在尝试做一个简单的 jquery $.get 调用以从服务器获取当前时间戳。
以下是代码:
javascript
var url = '/Utility/GetTimeStamp';
$.get(url, function(data){ $("#curr_time").val(data); });
c#mvc
public ActionResult GetTimeStamp()
{
string time_stamp = DateTime.Now.ToString("o");
return Content(time_stamp);
}
【问题讨论】:
-
302 表示数据在缓存中
-
我该如何摆脱这个错误?
-
做到了,还是一样..
-
是的。我也这样做了 var response = filterContext.HttpContext.Response; response.Cache.SetExpires(DateTime.UtcNow.AddDays(-1)); response.Cache.SetValidUntilExpires(false); response.Cache.SetRevalidation(HttpCacheRevalidation.AllCaches); response.Cache.SetCacheability(HttpCacheability.NoCache); response.Cache.SetNoStore();
-
302 不是重定向吗?
标签: c# jquery asp.net asp.net-mvc asp.net-mvc-3