小编Gig*_*apr的帖子

是否可以跨解决方案中的多个项目共享web.config?(ASP.NET)

我有一个由Web应用程序和多个项目组成的解决方案,是否可以在所有解决方案中共享Web应用程序中的配置?

谢谢

asp.net

6
推荐指数
2
解决办法
6583
查看次数

验证后为什么是假HttpContext.Current.Request.IsAuthenticated

我使用表单身份验证在我的网站上创建了一个登录,我不明白为什么在创建故障单并将其添加到cookie之后

如果我检查 HttpContext.Current.Request.IsAuthenticated

我弄错了.仅在连续请求时,用户才能进行身份验证

这是我的代码

var fat = new FormsAuthenticationTicket(
    1,
    username,
    DateTime.Now,
    DateTime.Now.AddMinutes(20),
    rememberMe,
    contact.Id + "," + contact.Role.Id,
    FormsAuthentication.FormsCookiePath);
HttpContext.Current.Response.Cookies.Add(new HttpCookie(FormsAuthentication.FormsCookieName, FormsAuthentication.Encrypt(fat)));
Run Code Online (Sandbox Code Playgroud)

在这一点,如果我检查HttpContext.Current.Request.IsAuthenticated我得到假,我认为这一点用户被认证...

这是我的配置

<authentication mode="Forms">
    <forms loginUrl="/Admin/Login.aspx" name="FormAuthentication" />
</authentication>
<authorization>
    <deny users="?"/>
</authorization>
Run Code Online (Sandbox Code Playgroud)

谢谢.

c# asp.net cookies forms-authentication

2
推荐指数
1
解决办法
2504
查看次数

标签 统计

asp.net ×2

c# ×1

cookies ×1

forms-authentication ×1