当我创建新合同时,我会向所有相关方发送电子邮件。但是,我的电子邮件中的链接将打开一个新屏幕,但只有当我按F5时,才会看到页面登录页面,然后是我要导航到的页面。我该如何解决? 典型的链接是
http://localhost:3838/Contract/Details/14
我的控制器操作
/****************
* DETAILS
************* */
[Authorize(Roles = "Reader,Inputter,Administrator")]
public ViewResult Details(int contractId)
{
return View(new ContractViewModel(contractId));
}
答案 0 :(得分:0)
您在测试时浏览器是否可以缓存网站?
听起来你正在使用IE的新版本:
Go to Tools --> Internet Options --> Temporary Internet Files --> Settings.
Set it to check for newer versions of stored pages "Every visit to the page".
或者如果您更喜欢代码修复,可以在控制器上使用NoCacheAttribute,但不建议这样做,因为您最终可能需要缓存:
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Method)]
public sealed class NoCacheAttribute : ActionFilterAttribute
{
public override void OnResultExecuting(ResultExecutingContext filterContext)
{
filterContext.HttpContext.Response.Cache.SetExpires(DateTime.UtcNow.AddDays(-1));
filterContext.HttpContext.Response.Cache.SetValidUntilExpires(false);
filterContext.HttpContext.Response.Cache.SetRevalidation(HttpCacheRevalidation.AllCaches);
filterContext.HttpContext.Response.Cache.SetCacheability(HttpCacheability.NoCache);
filterContext.HttpContext.Response.Cache.SetNoStore();
base.OnResultExecuting(filterContext);
}
}
[NoCache]
public class YourController : Controller
{
...
}