如何解决MVC ASP.NET-我的电子邮件上的链接不起作用-我需要刷新屏幕
|| 创建新合同时,我会向所有相关方发送电子邮件。但是,电子邮件中的链接将打开一个新屏幕,但是只有当我按F5键时,我才能看到页面登录页面,然后才是我要导航到的页面。我该如何解决? 一个典型的链接是 http:// localhost:3838 / Contract / Details / 14 我的控制器动作是 /****************
* DETAILS
************* */
[Authorize(Roles = \"Reader,Inputter,Administrator\")]
public ViewResult Details(int contractId)
{
return View(new Contractviewmodel(contractId));
}
解决方法
测试期间,浏览器可能会缓存网站吗?
听起来您正在使用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
{
...
}
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。