views:

72

answers:

1

I have a desktop app

I authenticate using the wcf authentication service login method, by calling the desktop application.

Everything seems to work.

I then open internet explorer and try and browse to a protected page.

I get bounced to the login.

Why? How can I authenticate using the WCF Service?

A: 

Internet Explorer and your desktop app are not the same application, so the forms authentication cookie can't be read/encrypted/decrypted by both at the same time. A method you might try is to embed a web-browser control in your desktop app (even make it invisible if you like) and perform a post login through an HttpWebRequest object (formulating post headers etc). This would instantiate a web browser and generate an auth cookie at the same time your desktop app logs in. I can't vouch for the security of it though.

Joel Etherton
so if my desktop app has an embedded web browser then I wouldn't be able to access the page because it is considered a different application? Is there a way to make a universal cookie?
zachary
@zachary - no, i'm suggesting that if you embed the web browser that the formsauthentication cookie will be generated from within the desktop application. It can be as you currently have it because your desktop application is not generating the cookie, it is only calling the webservice.
Joel Etherton
I tried creating a web application and calling the web service, but it still failed to remove the forms authentication and I was bounced from the application.... it is almost as though the service isn't creating a cookie...
zachary
@zachary - the service isn't creating a cookie. That's not its function, nor does it have the capacity to create such a cookie from within a desktop application. The embedded web browser was admittedly a shot in the dark.
Joel Etherton
Its weird because in the msdn help it says when you call the login method of the service it creates a cookie... I don't get it
zachary