开发者

send browser cookie to Web service

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();
     开发者_C百科   System.Net.CookieContainer cookie = new System.Net.CookieContainer();
        web.CookieContainer = cookie;

Brings me into totally new session.

Please help.

Best regards, Danny.


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?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜