Silverlight 和 ASP.NET 授权
我的网站使用表单身份验证。 我制作了 silverlight 3 模块,该模块旨在在经过身份验证的 asp 用户上下文中工作。 Silverlight 模块与同一 asp.net 网站托管的 WCF 进行通信,但问题是它无法对 WCF 服务进行身份验证。 我运行 Fiddler,发现 .ASPXAUTH cookie 未发送到 WCF 服务。 如何强制 Silverlight 从浏览器获取此 cookie 并将其发送到服务?
My website uses Forms authentication. I did silverlight 3 module which is designed to work in context of asp - authenticated user. Silverlight module talks with WCF hosted by the same asp.net website, but the issue is that it cannot authenticate to WCF service.
I run Fiddler and I see that .ASPXAUTH cookie is not sent to WCF service.
How to force Silverlight to get this cookie from browser and send it to service?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我已经使用成功了。 首先,我确保 ASP.NET 使用的 WCF AuthorizationService 有一个服务端点。 然后使用Silverlight项目生成AuthorizationService的“服务引用”。 最后,在您的模块中,您将使用该服务引用来使用您的提供商中存储的凭据来登录访问者。 如果您有更多关于如何构建网站的信息,我也许可以为您的问题提供更简洁的答案。
I've used it successfully. First, I make sure that there are is a service endpoint for the WCF AuthorizationService used by ASP.NET. Then use the Silverlight project to generate a "Service Reference" to the AuthorizationService. Finally, in your module, you will use that service reference to login your visitor using their credentials stored within your provider. If you have some more information on how you've built your site, I might be able to offer a more concise answer to your problem.
最后我解决了。
丢失cookie的问题是由不正确的主机名造成的。
我向
myhostname
发送 asp.net 请求,但 SL 使用myhostname.mylocaldomainnam.local
调用 WCF。 这就是 WCF 调用期间没有.aspauth
cookie 的原因。Finally I solved it.
The problem of missing cookie was made by inproper host name.
I was sending asp.net requests to
myhostname
, but SL was calling WCF usingmyhostname.mylocaldomainnam.local
. This is why there was no.aspauth
cookie during WCF calls.