验证使用窗体身份验证的LightSwitch OData的服务 [英] authenticate Lightswitch Odata service that uses forms authentication
问题描述
我创建使用LightSwitch的VS像这样的端点OData服务:
I created an OData service using VS Lightswitch with an endpoint like this:
http://mydevsite.com/lightswitchapps/mydata/products.svc
该服务与保护窗体身份验证。当我把网址到浏览器中,我问凭据。
The service is secured with forms authentication. When I put the url into a browser I am asked for credentials.
我要建立在C#控制台应用程序消耗的服务。但我不能找到如何验证任何的例子。
I want to build a console app in C# to consume the service. But I can't find any examples of how to authenticate.
我已经通过这种消耗的罗斯文服务工作:
I've worked through this which consumes the Northwind service:
http://msdn.microsoft。 COM / EN-US /库/ hh868028%28V = vs.103%29.aspx
但我需要与认证帮助。
任何人都可以点我在正确的方向?
Can anyone point me in the right direction?
推荐答案
我在的LightSwitch OData的服务相同的问题。
I had the same issue in LightSwitch OData Service.
下面是解决方案:
Uri uri = new Uri("https://localhost:5487/ApplicationData.svc/");
var container = new MyNameSpace.ApplicationData(uri);
container.Credentials = new NetworkCredential("username", "password");
这篇关于验证使用窗体身份验证的LightSwitch OData的服务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!