views:

151

answers:

1

Hi,

I have a following architecture:

1) client logins to ASP.NET web site (www.site.com) where the session expired in 3000 minutes and cookieless set to false.

2) After some time client opens Activex in browser. Activex connects to Session Enabled Web Service (www.site.com/Service.asmx) through .NET managed classes.

What I need to do is send cookies which browser recieved while authenticated through Web site. and if such cookie does not exist then the user is not authenticated and connection to Web service will be prohibited.

I understand that I need to use System.Net.CookieContainer class, but How do I set this broser cookie to this class?

            localhost.WebService1 web = new localhost.WebService1();
        System.Net.CookieContainer cookie = new System.Net.CookieContainer();
        web.CookieContainer = cookie;

Brings me into totally new session.

Please help.

Best regards, Danny.

+1  A: 

The ActiveX control is a completely separate process and will create its own session every time. Even though it uses the same browser as its container, it basically like running a separate application to connect to the webservice. To get around this, an idea would be to pass some kind of time-sensitive key/Guid to the ActviceX control (sent to the ActiveX control via javascript) This key (saved in database, created by the page) could be passed into the WebService and validated?

Mark Redman
Hi Mark, thank you for reply, You are right. This totally separate process. However take a look at YouTube. When you embbed youtube control and you want to view private movie, you will not be able to stream it until you login with google/youtube account and certainly youtube plugin and browser are different processes. So this is excatly what I'm searching to achieve.
danny.lesnik