【发布时间】:2018-01-03 23:48:20
【问题描述】:
使用asp.net core 2.0 mvc c#
我在同一个域中有 2 个应用程序,即
www.mydomain.com/app1
www.mydomain.com/app2
第一个应用程序 app1 上有一个链接,单击该链接会重定向到我的第二个应用程序 app2。
我想将一个 ID 从 app1 传递给 app2。我试过查询字符串。虽然我成功地设置了当重定向从一个页面到另一个页面时很难在我的 app2 中维护/传递这些内容。
所以我想到了使用 cookie。 我想要的是当用户点击 app1 中的链接时设置了一个 cookie,我被重定向到 app2,在这里我想检查设置的 cookie。
我想检查actionfilter中的cookie如下:
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Method, Inherited = true, AllowMultiple = false)]
public class MyCustomFilter: ActionFilterAttribute
{
public override void OnActionExecuting(ActionExecutingContext context)
{
//Here I want to check my cookie
}
}
我尝试使用 HttpContext.Response.Cookies.Get 但这不存在。
请指点。 谢谢
【问题讨论】:
标签: asp.net-core asp.net-core-mvc