ASP.Net Cross-Site Authentication

ε祈祈猫儿з 提交于 2019-12-06 08:20:42

Yes, you can reuse the auth page. Create a form in domain2.com pointing the auth uri in domain1.com

Citing w3schools:

the possible values of the action attribute are:

  • An absolute URL - points to another web site (like action="http://www.example.com/example.htm")
  • A relative URL - points to a file within a web site (like action="example.htm")

UPDATE: I'm supposing you want to only get authenticated for the pages of domain1. although you're sending the credentials from the domain2, you're POSTING your data and being redirected to domain1. so the auth cookie will only be valid for such domain (domain1).

This can be done by adding this to the web.config for both sites inside the system.web node.

 <machineKey validationKey="21F090935F6E49C2C797F69BBAAD8402ABD2EE0B667A8B44EA7DD4374267A75D7AD972A119482D15A4127461DB1DC347C1A63AE5F1CCFAACFF1B72A7F0A281B"
        decryptionKey="261F793EB53B761503AC445E0CA28DA44AA9B3CF06263B77"
        validation="SHA1"/>

This will allow the apps to share authentication data via the cookie on the client's machine.

You will want to generate a private validation and decryption key. This Microsoft page explains how http://support.microsoft.com/kb/312906

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!