views:

253

answers:

1

I am new to Silverlight, and I building a simple app which provides an interface for an expense report portal. The portal has a REST API which I can access; I know I can do it using WebClient or WebHttpRequest. However, to be able to access the API, I need to login first. The login is simple forms authentication on login.aspx of the site. How do I login (post to the login page) from Silverlight?

NOTE: The site has the clientaccesspolicy.xml setup, and I am able to access the REST URL that do not require you to be logged on.

A: 

Have you looked at the Silverlight Business Application project template and WCF Ria Services. The template has built in functionality to login to a forms authenticated website.

You can use this as a starting point for your silverlight application or simply use it to see how to perform authentication from silverlight.

geoff
I 2nd the motion that he look at WCF RIA. Especially if it's simple. It's like it was designed with you in mind (much to the displeasure of our complex usages of it)
thepaulpage
I had a look at the WCF Ria Services, but I didn't find anything that could help me. What I ended up doing was using a HttpWebRequest to post to the login page and then I stripped out the cookie from the response and use the cookie for future requests.
Terenced
Well, at least you've solved your problem. I still believe that RIA services would have been the easiest route. Out the box, the Business Application template has the ability to log users in and out.
geoff