TAILIEUCHUNG - ASP.NET 4 Unleased - p 125

Bạn có thể thêm một yếu tố machineKey với các phím rõ ràng cho một trong hai tập tin cấu hình máy chủ web hoặc ứng dụng cụ thể vào các file cấu hình web. Nếu bạn không muốn chia sẻ cùng các phím trên tất cả các ứng dụng trên một máy chủ web, bạn nên thêm vào các phần tử machineKey duy nhất để các ứng dụng mà bạn cần chia sẻ. | 1214 CHAPTER 27 Using Membership FIGURE Generating cryptographically strong keys. You can add a machineKey element with explicit keys to either the machine root web configuration file or to particular application web configuration files. If you don t want to share the same keys across all the applications on a web server you should add the machineKey element only to the applications that you need to share. Using Forms Authentication Across Domains In the previous section you learned how to share the same authentication cookie across applications located on the same server or a different server. But how do you share the same authentication cookie across domains A browser cookie is always domain relative. For example the Amazon website cannot read cookies set by the Barnes Noble website which is a good thing. However you might discover that you need to share authentication information across websites with different domains. You can work around this problem by passing an authentication ticket in a query string parameter rather than in a cookie. There is nothing to prevent you from passing query strings between domains. To enable this scenario you must configure your applications to accept authentication tickets passed in a query string. The web configuration file in Listing includes an enableCrossAppRedirects attribute that enables sharing authentication tickets across domains. From the Library of Wow eBook Configuring Authentication 1215 LISTING xml version configuration authentication mode Forms forms enableCrossAppRedirects true authentication machineKey decryption AES validation SHA1 decryptionKey 306C1FA852AB3B0115150DD8BA30821CDFD125538A0C606DACA5 -3DBB3C3E0AD2 validationKey 61A8E04A146AFFAB81B6AD19654F99EA7370807F18F5002725DAB98B8E -FD19C711337E26948E26D1D174B159973EA0BE8CC9CAA6AAF513BF84E44B2247792265 configuration If you add the web configuration file in Listing to two applications located in .

200    2    0    12-08-2020
8    4    0    12-08-2020