简体   繁体   English

如何确定 ASP.Net web 应用程序是否可以处理基于 cookie 的亲和力?

[英]How to find out if ASP.Net web application can handle cookie-based affinity?

I was reading this article about troubleshooting Azure Application Gateway Session Affinity Issues, and listed as a possible cause it states "My application cannot handle cookie-based affinity", how do I know if my ASP.Net web application can handle cookie based affinity or not?我正在阅读这篇关于故障排除 Azure 应用程序网关 Session 关联问题的文章,并将其列为可能的原因,它指出“我的应用程序无法处理基于 cookie 的关联”,我如何知道我的 ASP.Net Z2567A5EC9705EB189AC2Z 应用程序是否可以处理基于 cookie 的关联或基于 cookie 的关联不是?

Thanks,谢谢,

Firstly, as you're hosting the website on an Azure VM, you would typically deal the same way as you would on-prem, unlike on Azure App Service VM- for this setting - you can just toggle switch to enable or disable ARR Affinity from Azure Portal > Application Settings.首先,当您在 Azure 虚拟机上托管网站时,您通常会以与本地相同的方式进行处理,这与 Azure 应用服务虚拟机不同 - 对于此设置 - 您只需切换开关以启用或禁用 ARR Affinity从 Azure 门户 > 应用程序设置。

Kindly refer this blog Upcoming SameSite Cookie Changes in ASP.NET and ASP.NET Core for the latest changes.请参阅此博客ASP.NET 和 ASP.NET 核心中即将发生的 SameSite Cookie 更改以获取最新更改。

Just to clarify -The application gateway can only perform session-based affinity by using a cookie.只是为了澄清 - 应用程序网关只能通过使用 cookie 来执行基于会话的亲和性。 From your issue description, you have set "cookieBasedAffinity": "Enabled", as mentioned in the document, is that correct?从您的问题描述中,您已设置“cookieBasedAffinity”:“已启用”,如文档中所述,是否正确? You can leverage based on your application needs.您可以根据您的应用程序需求加以利用。

<httpCookies domain="" httpOnlyCookies="true|false" requireSSL="true|false" />

You cannot add cookies in web.config but you can add some custom section to access cookies.您不能在 web.config 中添加 cookies,但您可以添加一些自定义部分来访问 cookies。 You can handle this via code use the System.Web.HttpCookie.HttpOnly property.您可以使用 System.Web.HttpCookie.HttpOnly 属性通过代码处理此问题。 as mentioned in this article .本文所述

    myHttpOnlyCookie.HttpOnly = true;
    myHttpOnlyCookie.Name = "MyHttpOnlyCookie";
    Response.AppendCookie(myHttpOnlyCookie);

As mentioned in the same document you're referring to, you can review the session logs to determine whether the cookies provided by the client have the ARRAffinity details If you don't find the ARRAffinity details, such as "ARRAffinity= ARRAffinityValue" within the cookie set, that means the client is not replying with the ARR cookie.如您所指的同一文档中所述,您可以查看 session 日志以确定客户端提供的 cookies 是否具有 ARRAffinity 详细信息如果您在cookie 集,这意味着客户端没有使用 ARR cookie 进行回复。

Additional discussion on this topic- Token Authentication vs. Cookies关于此主题的其他讨论 - 令牌认证与 Cookies

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 无状态ASP.NET MVC 6应用程序中基于Cookie的身份验证 - Cookie-based Authentication in stateless ASP.NET MVC 6 application 基于ASP.NET Cookie的会话,是否有SessionStateModule? - ASP.NET cookie-based sessions, is there SessionStateModule for it? 跨MVC 5和ASP.NET核心应用程序的基于Cookie的表单身份验证 - Cookie-based Forms Authentication Across MVC 5 and ASP.NET Core applications 如何确定当前应用程序是否为 ASP.NET web 应用程序 - How to find out if the current application is an ASP.NET web app 如何在ASP.NET Web窗体应用程序和ASP.NET核心应用程序之间共享会话和Cookie? - How to share session and cookie between asp.net web form application and asp.net core application? 如何在ASP.net Web应用程序中处理PageRequestManagerTimeoutException? - how to handle PageRequestManagerTimeoutException in ASP.net Web Application? 如何从 Web 应用程序中找出 ASP.NET 中的会话大小? - How to find out size of session in ASP.NET from web application? 在asp.net Web应用程序中查找有多少用户在线 - Find out how many users are online in asp.net web application 如何找出重新启动ASP.NET Web应用程序的原因 - How to find out why an ASP.NET web application is being restarted 可以与ASP.Net应用程序一起使用的基于Web的工作流设计器? - Web based workflow designer that can be used with ASP.Net application?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM