我从 ACS 门户为我的应用程序下载了示例登录页面,这是一个 html 文件。然后我用 WIF 配置了我的应用程序,一切都运行良好。
由于我们需要处理和保存传入的查询字符串,以便用户登录后可以稍后使用查询字符串,因此我们需要将 html 登录页面移动到 aspx 页面。
问题是当我将 web.config 文件中 WIF 的颁发者更改为 aspx 文件时,它停止工作。当它工作时,它看起来像这样:
<certificateValidation certificateValidationMode="None" />
<federatedAuthentication>
<wsFederation passiveRedirectEnabled="true" issuer="http://localhost:81/acstest/WebSiteAdvancedACSLoginPageCode.html" realm="http://localhost:81/acstest/" requireHttps="false" />
<cookieHandler requireSsl="false" />
</federatedAuthentication>
但是当我将其更改为我的 aspx 页面时,我只是将 html 页面中的所有代码移入其中,我什至无法加载该页面:
<certificateValidation certificateValidationMode="None" />
<federatedAuthentication>
<wsFederation passiveRedirectEnabled="true" issuer="http://localhost:81/acstest/WebSiteAdvancedACSLoginPageCode.aspx" realm="http://localhost:81/acstest/" requireHttps="false" />
<cookieHandler requireSsl="false" />
</federatedAuthentication>
然后,当我使用配置的 aspx 文件运行时,我可以在 fiddler 中看到一些不正确的东西,它尝试获取,并不断获取“对象移动到此处:”这是获取请求:
GET http://localhost:81/acstest/WebSiteAdvancedACSLoginPageCode.aspx?wa=wsignin1.0&wtrealm=http%3a%2f%2flocalhost%3a81%2facstest%2f&wctx=rm%3d0%26id%3dpassive%26ru%3d%252facstest%252fWebSiteAdvancedACSLoginPageCode.aspx&wct=2011-11-23T09%3a33%3a30Z HTTP/1.1
Accept: text/html, application/xhtml+xml, */*
Accept-Language: sv-SE
User-Agent: Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64; Trident/5.0)
Accept-Encoding: gzip, deflate
Connection: Keep-Alive
Host: localhost:81
Cookie: ACSChosenIdentityProvider-10001951=Google
最后它会抛出查询字符串太长的异常。请求的错误和警告:
MODULE_SET_RESPONSE_ERROR_STATUS
ModuleName UrlAuthorization
通知 AUTHORIZE_REQUEST
Http状态 401
HttpReason 未经授权
HttpSubStatus 0
ErrorCode Åtgärden har slutförts。(0x0)
配置异常信息
任何反馈或替代解决方案都值得赞赏。