Solved

Reading the ASP.NET_SessionID Cookie value from an ASP>Net web service

Posted on 2006-10-20
4
1,019 Views
Last Modified: 2010-08-05
I have used the following article to maintain sessions in a web service :

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnservice/html/service08062002.asp

using the following code I would like to read the value (SessionID) that is set in the cookie returned in the web service result.

Private Cookies As System.Net.CookieContainer

Private Sub Button1_Click(ByVal sender As System.Object, _
    ByVal e As System.EventArgs) Handles Button1.Click
    Dim proxy As New localhost.Service1()
    Dim ret As Integer
    ' Set the Cookie Container on the proxy
    If Cookies Is Nothing Then
        Cookies = New System.Net.CookieContainer()
    End If
    proxy.CookieContainer = Cookies
    ret = proxy.IncrementSessionCounter()
    Label1.Text = "Result: " & CStr(ret)
End Sub


after the web service comes back I can see that Cookies.Count gets set to 1 but I can't find a way to read the cookie value.

please help
0
Comment
Question by:webprouk
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 4

Expert Comment

by:hclgroup
ID: 17773927
0
 
LVL 7

Accepted Solution

by:
nepali earned 500 total points
ID: 17774707
Try this ..
If the your webservice url is
http://127.0.0.1/TestSessionState/zzz.asmx

   Dim z1 As New localhost.zzz()
        ' Set the Cookie Container on the proxy
        If Cookies Is Nothing Then
            Cookies = New System.Net.CookieContainer
        End If
        z1.CookieContainer = Cookies
        Dim uri1 As New Uri("http://127.0.0.1/TestSessionState/zzz.asmx")
        For Each zzzcookie As System.Net.Cookie In z1.CookieContainer.GetCookies(uri1)
            Debug.WriteLine(zzzcookie.Value)
        Next
0
 
LVL 1

Author Comment

by:webprouk
ID: 17774846
this gets the cookie info of the web page - not the cookie info sent from the web service.
0
 
LVL 1

Author Comment

by:webprouk
ID: 17775303
thanks a lot nepali, that did the trick
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Recommendation vb6 to vb.net or others 14 205
Regular Expression Calculator Tester 2 89
programming a polycom voip phone 3 54
Programming Language for Wordpress 7 63
This is about my first experience with programming Arduino.
This article will inform Clients about common and important expectations from the freelancers (Experts) who are looking at your Gig.
An introduction to basic programming syntax in Java by creating a simple program. Viewers can follow the tutorial as they create their first class in Java. Definitions and explanations about each element are given to help prepare viewers for future …

749 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question