danny.lesnik
danny.lesnik

Reputation: 18639

Passing existing cookie to Web service

HI have the following scenario:

1) i'm authenticated against some aSP.NET web site and my session time out expires in 24 hours.

2) after several time I would like to run query against asp.net Web Service located on the site using existing authentication.

What should I add to cookie Container? I how do sent existing cookie to Web service?

Thank you in Advance. Danny.

Upvotes: 2

Views: 750

Answers (1)

Dave Walker
Dave Walker

Reputation: 3523

A web service call is just an http call so it will come under the existing authentication.

I am assuming here that you are issuing this from the browser?

If not - e.g. if you are doing it from a console application, then you will have to interact with the site as if you were a user. Some more details are her http://www.ksingla.net/2006/08/sample_forms_authentication_test_in_csharp/

Basically you need to issue a post to login to the login page - track all of the cookies etc - and then start issuing your WS calls with those cookies.

Another option is here http://en.gli.sh/Blog/post/NET-Interoperability-Between-Smart-Client-and-Internet-Explorer-Using-Cookie-based-Authentication.aspx which is reading the correct cookie info from the windows machine you are on - relies on you being logged into the website and also trusted to be able to get to that file.

Alternatively you can look into implementing WSE or WCF solution.

Upvotes: 1

Related Questions