Reputation: 2210
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.
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/library/hh868028%28v=vs.103%29.aspx
But I need help with the authentication.
Can anyone point me in the right direction?
Upvotes: 0
Views: 765
Reputation: 422
I had the same issue in LightSwitch OData Service.
Here is the solution :
Uri uri = new Uri("https://localhost:5487/ApplicationData.svc/");
var container = new MyNameSpace.ApplicationData(uri);
container.Credentials = new NetworkCredential("username", "password");
Upvotes: 1
Reputation: 3347
It seems that your question is similar to this one: HttpClient and forms authentication in C# Please reference it.
Upvotes: 0